gcc/testsuite/gcc.dg/tm/pr46654.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fgnu-tm" } */ |
| 3 | |
| 4 | extern void baz(int); |
| 5 | |
| 6 | int y; |
| 7 | void foo(volatile int x) |
| 8 | { |
| 9 | __transaction_atomic { |
| 10 | x = 5; /* { dg-error "invalid use of volatile lvalue inside transaction" } */ |
| 11 | x += y; |
| 12 | y++; |
| 13 | } |
| 14 | baz(x); |
| 15 | } |
| 16 | |
| 17 | |
| 18 | volatile int i = 0; |
| 19 | |
| 20 | void george() |
| 21 | { |
| 22 | __transaction_atomic { |
| 23 | if (i == 2) /* { dg-error "invalid use of volatile lvalue inside transaction" } */ |
| 24 | i = 1; |
| 25 | } |
| 26 | } |