2011-09-27 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / libgomp / testsuite / libgomp.c / pr32362-2.c
blob43f36e0e98be12ccaeeff4a399574b842e0e2c72
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, b = 4;
10 int
11 main ()
13 int n[4] = { -1, -1, -1, -1 };
14 omp_set_num_threads (4);
15 omp_set_dynamic (0);
16 omp_set_nested (1);
17 #pragma omp parallel private(b)
19 b = omp_get_thread_num ();
20 #pragma omp parallel firstprivate(a)
22 a = (omp_get_thread_num () + a) + 1;
23 if (b == omp_get_thread_num ())
24 n[omp_get_thread_num ()] = a + (b << 4);
27 if (n[0] != 3)
28 abort ();
29 if (n[3] != -1
30 && (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36))
31 abort ();
32 return 0;