include/
[official-gcc.git] / libgomp / testsuite / libgomp.c / omp-single-2.c
blob6878559739751c53c493878688b8b7f859837da0
1 #include <omp.h>
3 extern void abort (void);
5 struct X
7 int a;
8 char b;
9 int c;
12 main()
14 int i = 0;
15 struct X x;
16 int bad = 0;
18 #pragma omp parallel private (i, x) shared (bad)
20 i = 5;
22 #pragma omp single copyprivate (i, x)
24 i++;
25 x.a = 23;
26 x.b = 42;
27 x.c = 26;
30 if (i != 6 || x.a != 23 || x.b != 42 || x.c != 26)
31 bad = 1;
34 if (bad)
35 abort ();
37 return 0;