testsuite/libgomp.c/pr32362-2.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, b = 4;
00009 
00010 int
00011 main ()
00012 {
00013   int n[4] = { -1, -1, -1, -1 };
00014   omp_set_num_threads (4);
00015   omp_set_dynamic (0);
00016   omp_set_nested (1);
00017 #pragma omp parallel private(b)
00018   {
00019     b = omp_get_thread_num ();
00020 #pragma omp parallel firstprivate(a)
00021     {
00022       a = (omp_get_thread_num () + a) + 1;
00023       if (b == omp_get_thread_num ())
00024     n[omp_get_thread_num ()] = a + (b << 4);
00025     }
00026   }
00027   if (n[0] != 3)
00028     abort ();
00029   if (n[3] != -1
00030       && (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36))
00031     abort ();
00032   return 0;
00033 }

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