gcc/testsuite/c-c++-common/tm/volatile-1.c
raw| 1 | // Transaction-unsafe testcase from TM TS. |
| 2 | // { dg-options -fgnu-tm } |
| 3 | |
| 4 | volatile int * p = 0; |
| 5 | __attribute ((transaction_safe)) |
| 6 | void f() { |
| 7 | int x = 0; // ok: not volatile |
| 8 | p = &x; // ok: the pointer is not volatile |
| 9 | int i = *p; // { dg-error "volatile" "read through volatile glvalue" } |
| 10 | } |