1 #include <omp.h> 2 3 extern void abort (void); 4 5 struct X 6 { 7 int a; 8 char b; 9 int c; 10 }; 11 12 int main()13main() 14 { 15 int i = 0; 16 struct X x; 17 int bad = 0; 18 19 #pragma omp parallel private (i, x) shared (bad) 20 { 21 i = 5; 22 23 #pragma omp single copyprivate (i, x) 24 { 25 i++; 26 x.a = 23; 27 x.b = 42; 28 x.c = 26; 29 } 30 31 if (i != 6 || x.a != 23 || x.b != 42 || x.c != 26) 32 bad = 1; 33 } 34 35 if (bad) 36 abort (); 37 38 return 0; 39 } 40