1 #include <omp.h>
2 #include <stdlib.h>
3 
4 int
main(void)5 main (void)
6 {
7   int err = 0;
8 
9   omp_set_num_threads (4);
10   if (omp_get_max_threads () != 4)
11     abort ();
12   #pragma omp parallel reduction(|: err) num_threads(1)
13   {
14     if (omp_get_max_threads () != 4)
15       err |= 1;
16     omp_set_num_threads (6);
17     #pragma omp task if(0) shared(err)
18     {
19       if (omp_get_max_threads () != 6)
20 	err |= 2;
21       omp_set_num_threads (5);
22       if (omp_get_max_threads () != 5)
23 	err |= 4;
24     }
25     if (omp_get_max_threads () != 6)
26       err |= 8;
27   }
28   if (err)
29     abort ();
30   if (omp_get_max_threads () != 4)
31     abort ();
32   return 0;
33 }
34