1 /* PR c++/38650 */ 2 /* { dg-do run } */ 3 4 #include <stdlib.h> 5 6 int e; 7 8 int main()9main () 10 { 11 volatile int i, j = 10; 12 e = 0; 13 #pragma omp parallel for reduction(+:e) 14 for (i = 0; i < j; i += 1) 15 e++; 16 if (e != 10) 17 abort (); 18 e = 0; 19 #pragma omp parallel for reduction(+:e) 20 for (i = 0; i < j; ++i) 21 e++; 22 if (e != 10) 23 abort (); 24 e = 0; 25 #pragma omp parallel for reduction(+:e) 26 for (i = 0; i < j; i++) 27 e++; 28 if (e != 10) 29 abort (); 30 e = 0; 31 #pragma omp parallel for reduction(+:e) 32 for (i = 0; i < 10; i += 1) 33 e++; 34 if (e != 10) 35 abort (); 36 e = 0; 37 #pragma omp parallel for reduction(+:e) 38 for (i = 0; i < 10; ++i) 39 e++; 40 if (e != 10) 41 abort (); 42 e = 0; 43 #pragma omp parallel for reduction(+:e) 44 for (i = 0; i < 10; i++) 45 e++; 46 if (e != 10) 47 abort (); 48 return 0; 49 } 50