summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/atomic-4.c
blob: 7f27370d535b6f1f1c360d25195ee1e6b2631395 (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
/* { dg-do compile } */

int a[4];
int *p;
struct S { int x; int y[4]; } s;
int *bar(void);

void f1(void)
{
  #pragma omp atomic
    a[4] += 1;
  #pragma omp atomic
    *p += 1;
  #pragma omp atomic
    s.x += 1;
  #pragma omp atomic
    s.y[*p] += 1;
  #pragma omp atomic
    s.y[*p] *= 42;
  #pragma omp atomic
    *bar() += 1;
  #pragma omp atomic
    *bar() *= 42;
}