2018-01-22 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / libgomp / testsuite / libgomp.c++ / single-2.C
blobd24b1d85e667c502524c13fa7534d61d22e927ae
1 extern "C" void abort (void);
3 struct X
5   int a;
6   char b;
7   int c;
8 };
10 int
11 main()
13   int i = 0;
14   struct X x;
15   int bad = 0;
17   #pragma omp parallel private (i, x) shared (bad)
18     {
19       i = 5;
21       #pragma omp single copyprivate (i, x)
22         {
23           i++;
24           x.a = 23;
25           x.b = 42;
26           x.c = 26;
27         }
29       if (i != 6 || x.a != 23 || x.b != 42 || x.c != 26)
30         bad = 1;
31     }
33   if (bad)
34     abort ();
36   return 0;