diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/gomp/atomic-5.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/atomic-5.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-5.c b/gcc/testsuite/gcc.dg/gomp/atomic-5.c new file mode 100644 index 00000000000..445f7805f70 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/atomic-5.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ + +int x; +const int y; +int bar(void); + +void f1(void) +{ + register int z; + + #pragma omp atomic + x %= 2; /* { dg-error "invalid operator" } */ + #pragma omp atomic + x = x + 1; /* { dg-error "invalid operator" } */ + #pragma omp atomic + x = 1; /* { dg-error "invalid operator" } */ + #pragma omp atomic + ++y; /* { dg-error "read-only variable" } */ + #pragma omp atomic + y--; /* { dg-error "read-only variable" } */ + #pragma omp atomic + y += 1; /* { dg-error "read-only variable" } */ + #pragma omp atomic + z += 1; /* { dg-error "register variable" } */ + #pragma omp atomic + bar(); /* { dg-error "invalid operator" } */ + #pragma omp atomic + bar() += 1; /* { dg-error "lvalue required" } */ + #pragma omp atomic a /* { dg-error "expected end of line" } */ + x++; + #pragma omp atomic + ; /* { dg-error "expected expression" } */ + #pragma omp atomic + #pragma omp atomic /* { dg-error "expected expression" } */ + ; + /* Check that we didn't get stuck on the pragma eol marker. */ + undef; /* { dg-error "" } */ +} |