]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libgomp/lib/contrib/gcc-4.3/libgomp/testsuite/libgomp.c/pr32362-3.c
Inital import
[l4.git] / l4 / pkg / libgomp / lib / contrib / gcc-4.3 / libgomp / testsuite / libgomp.c / pr32362-3.c
1 /* PR middle-end/32362 */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
4
5 #include <omp.h>
6 #include <stdlib.h>
7
8 int a = 2;
9
10 int
11 main ()
12 {
13   int n[4] = { -1, -1, -1, -1 };
14   int b = 4;
15   omp_set_num_threads (4);
16   omp_set_dynamic (0);
17   omp_set_nested (1);
18 #pragma omp parallel private(b)
19   {
20     b = omp_get_thread_num ();
21 #pragma omp parallel firstprivate(a)
22     {
23       a = (omp_get_thread_num () + a) + 1;
24       if (b == omp_get_thread_num ())
25         n[omp_get_thread_num ()] = a + (b << 4);
26     }
27   }
28   if (n[0] != 3)
29     abort ();
30   if (n[3] != -1
31       && (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36))
32     abort ();
33   return 0;
34 }