Merge from mainline
[official-gcc.git] / libgomp / testsuite / libgomp.c / nested-1.c
blobd3cfb01006980e8d606cb857ff85f438a8069049
1 #include <omp.h>
2 #include <stdlib.h>
4 int
5 main (void)
7 int i = -1, j = -1;
9 omp_set_nested (1);
10 omp_set_dynamic (0);
11 #pragma omp parallel num_threads (4)
13 #pragma omp single
15 i = omp_get_thread_num () + omp_get_num_threads () * 256;
16 #pragma omp parallel num_threads (2)
18 #pragma omp single
20 j = omp_get_thread_num () + omp_get_num_threads () * 256;
25 if (i < 4 * 256 || i >= 4 * 256 + 4)
26 abort ();
27 if (j < 2 * 256 || j >= 2 * 256 + 2)
28 abort ();
29 return 0;