1// { dg-do compile } 2// { dg-options "-fgnu-tm -O1" } 3 4__attribute__((transaction_pure)) 5inline int atomic_exchange_and_add(int dv ) 6{ 7 int r; 8 __asm__ ("" : "=r"(r)); 9 return r; 10} 11 12class sp_counted_base 13{ 14public: 15 __attribute__((transaction_safe)) 16 void release() 17 { 18 if( atomic_exchange_and_add(-1 ) == 1 ) 19 { 20 } 21 } 22}; 23 24sp_counted_base *base; 25 26void here(){ 27 __transaction_atomic { 28 base->release(); 29 } 30} 31