testsuite/libgomp.c/pr32362-3.c

Go to the documentation of this file.
00001 /* PR middle-end/32362 */
00002 /* { dg-do run } */
00003 /* { dg-options "-O2" } */
00004 
00005 #include <omp.h>
00006 #include <stdlib.h>
00007 
00008 int a = 2;
00009 
00010 int
00011 main ()
00012 {
00013   int n[4] = { -1, -1, -1, -1 };
00014   int b = 4;
00015   omp_set_num_threads (4);
00016   omp_set_dynamic (0);
00017   omp_set_nested (1);
00018 #pragma omp parallel private(b)
00019   {
00020     b = omp_get_thread_num ();
00021 #pragma omp parallel firstprivate(a)
00022     {
00023       a = (omp_get_thread_num () + a) + 1;
00024       if (b == omp_get_thread_num ())
00025     n[omp_get_thread_num ()] = a + (b << 4);
00026     }
00027   }
00028   if (n[0] != 3)
00029     abort ();
00030   if (n[3] != -1
00031       && (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36))
00032     abort ();
00033   return 0;
00034 }

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