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