2011-09-27 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / libgomp / testsuite / libgomp.c / pr32362-3.c
blob09a88f52a3b6fd8f7bcfa8454e9973035045ca6c
1 /* PR middle-end/32362 */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
5 #include <omp.h>
6 #include <stdlib.h>
8 int a = 2;
10 int
11 main ()
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)
20 b = omp_get_thread_num ();
21 #pragma omp parallel firstprivate(a)
23 a = (omp_get_thread_num () + a) + 1;
24 if (b == omp_get_thread_num ())
25 n[omp_get_thread_num ()] = a + (b << 4);
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;