| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fgnu-tm" } */ |
| 3 |
/* { dg-add-options bind_pic_locally } */ |
| 4 |
|
| 5 |
void f_extern (void); |
| 6 |
void f_first (void); |
| 7 |
void f_later (void); |
| 8 |
|
| 9 |
extern int x; |
| 10 |
|
| 11 |
void f_first (void) { x++; } |
| 12 |
|
| 13 |
void __attribute__((transaction_safe)) |
| 14 |
test_safe (void) |
| 15 |
{ |
| 16 |
f_extern (); /* { dg-error "unsafe function call" } */ |
| 17 |
f_first (); |
| 18 |
f_later (); |
| 19 |
} |
| 20 |
|
| 21 |
void __attribute__((transaction_may_cancel_outer)) |
| 22 |
test_mco (void) |
| 23 |
{ |
| 24 |
f_extern (); /* { dg-error "unsafe function call" } */ |
| 25 |
f_first (); |
| 26 |
f_later (); |
| 27 |
} |
| 28 |
|
| 29 |
void |
| 30 |
test_atomic (void) |
| 31 |
{ |
| 32 |
__transaction_atomic { |
| 33 |
f_extern (); /* { dg-error "unsafe function call" } */ |
| 34 |
f_first (); |
| 35 |
f_later (); |
| 36 |
} |
| 37 |
__transaction_relaxed { |
| 38 |
f_extern (); |
| 39 |
f_first (); |
| 40 |
f_later (); |
| 41 |
} |
| 42 |
__transaction_atomic [[outer]] { |
| 43 |
f_extern (); /* { dg-error "unsafe function call" } */ |
| 44 |
f_first (); |
| 45 |
f_later (); |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
void f_later () { f_first(); test_safe(); } |