1 /* PR middle-end/25261 */ 2 /* { dg-do run } */ 3 4 #include <omp.h> 5 6 extern void abort (void); 7 8 int main(void)9main (void) 10 { 11 int i = 5, j, l = 0; 12 int foo (void) 13 { 14 return i == 6; 15 } 16 int bar (void) 17 { 18 return i - 3; 19 } 20 21 omp_set_dynamic (0); 22 23 #pragma omp parallel if (foo ()) num_threads (2) 24 if (omp_get_num_threads () != 1) 25 #pragma omp atomic 26 l++; 27 28 #pragma omp parallel for schedule (static, bar ()) num_threads (2) \ 29 reduction (|:l) 30 for (j = 0; j < 4; j++) 31 if (omp_get_thread_num () != (j >= 2)) 32 #pragma omp atomic 33 l++; 34 35 i++; 36 37 #pragma omp parallel if (foo ()) num_threads (2) 38 if (omp_get_num_threads () != 2) 39 #pragma omp atomic 40 l++; 41 42 #pragma omp parallel for schedule (static, bar ()) num_threads (2) \ 43 reduction (|:l) 44 for (j = 0; j < 6; j++) 45 if (omp_get_thread_num () != (j >= 3)) 46 #pragma omp atomic 47 l++; 48 49 #pragma omp parallel num_threads (4) reduction (|:l) 50 if (!foo () || bar () != 3) 51 #pragma omp atomic 52 l++; 53 54 i++; 55 56 #pragma omp parallel num_threads (4) reduction (|:l) 57 if (foo () || bar () != 4) 58 #pragma omp atomic 59 l++; 60 61 if (l) 62 abort (); 63 64 return 0; 65 } 66