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