summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/atomic-5.c
blob: be7cbb862acfebf14ade71abed71650fe2b925b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* { 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 "" } */
  /* { dg-message "undeclared identifier is reported only once" "reminder" { target *-*-* } 37 } */
}