1 // { dg-do compile }
2
3 extern void baz(int);
foo(int j,int k)4 void foo (int j, int k)
5 {
6 int i;
7
8 /* Valid loops. */
9 #pragma omp for
10 for (i = 0; i < 10; i++)
11 baz (i);
12
13 #pragma omp for
14 for (i = j; i <= 10; i+=4)
15 baz (i);
16
17 #pragma omp for
18 for (i = j; i > 0; i = i - 1)
19 baz (j);
20
21 #pragma omp for
22 for (i = j; i >= k; i--)
23 baz (i);
24
25 // Malformed parallel loops.
26 #pragma omp for
27 i = 0; // { dg-error "for statement expected" }
28 for ( ; i < 10; )
29 {
30 baz (i);
31 i++;
32 }
33
34 #pragma omp for
35 for (i = 0; ; i--) // { dg-error "missing controlling predicate" }
36 {
37 if (i >= 10)
38 break; // { dg-error "break" }
39 baz (i);
40 }
41
42 #pragma omp for
43 for (i = 0; i < 10 && j > 4; i-=3) // { dg-error "invalid controlling predicate" }
44 baz (i);
45
46 #pragma omp for
47 for (i = 0; i < 10; i-=3, j+=2) // { dg-error "invalid increment expression" }
48 baz (i);
49 }
50