summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++/pr35185.C
blob: f22c7720787b7971e09f724e5627160cfbe55be5 (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
// PR middle-end/35185
// { dg-do run }

extern "C" void abort ();

struct S
{
  S () : s (6) {}
  ~S () {}
  int s;
};

__attribute__((noinline))
bool
bar (S s)
{
  return s.s != 6;
}

int
main ()
{
  S s;
  int err = 0;
#pragma omp parallel shared (s)
  {
    if (bar (s))
      #pragma omp atomic
	err++;
  }
  if (err)
    abort ();
}