Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/imperfect3.c

raw
1 /* { dg-do compile } */
2
3 /* This test case is expected to fail due to errors. */
4
5 /* Test that the imperfectly-nested loops with the ordered clause gives
6 an error, and that there is only one error (and not one on every
7 intervening statement). */
8
9 int f1 (int depth, int iter);
10 int f2 (int depth, int iter);
11
12 void s1 (int a1, int a2, int a3)
13 {
14 int i, j, k;
15
16 /* This loop without intervening code ought to be OK. */
17 #pragma omp for ordered(3)
18 for (i = 0; i < a1; i++)
19 {
20 for (j = 0; j < a2; j++)
21 {
22 for (k = 0; k < a3; k++)
23 {
24 f1 (2, k);
25 f2 (2, k);
26 #pragma omp ordered doacross(source:omp_cur_iteration)
27 #pragma omp ordered doacross(sink: i - 2, j + 2, k - 1)
28 }
29 }
30 }
31
32 /* Now add intervening code. */
33 #pragma omp for ordered(3)
34 for (i = 0; i < a1; i++) /* { dg-error "inner loops must be perfectly nested" } */
35 {
36 f1 (0, i);
37 for (j = 0; j < a2; j++)
38 {
39 f1 (1, j);
40 for (k = 0; k < a3; k++)
41 {
42 f1 (2, k);
43 f2 (2, k);
44 #pragma omp ordered doacross(source:omp_cur_iteration)
45 #pragma omp ordered doacross(sink: i - 2, j + 2, k - 1)
46 }
47 f2 (1, j);
48 }
49 f2 (0, i);
50 }
51 }
52