testsuite/libgomp.c/omp-single-2.c

Go to the documentation of this file.
00001 #include <omp.h>
00002 
00003 extern void abort (void);
00004 
00005 struct X
00006 {
00007   int a;
00008   char b;
00009   int c;
00010 };
00011 
00012 main()
00013 {
00014   int i = 0;
00015   struct X x;
00016   int bad = 0;
00017 
00018   #pragma omp parallel private (i, x) shared (bad)
00019     {
00020       i = 5;
00021 
00022       #pragma omp single copyprivate (i, x)
00023     {
00024       i++;
00025       x.a = 23;
00026       x.b = 42;
00027       x.c = 26;
00028     }
00029 
00030       if (i != 6 || x.a != 23 || x.b != 42 || x.c != 26)
00031     bad = 1;
00032     }
00033 
00034   if (bad)
00035     abort ();
00036 
00037   return 0;
00038 }

Generated on Fri Apr 5 05:38:10 2013 for Libgomp by  doxygen 1.4.7