Debian Codegraph @

gcc/testsuite/g++.dg/gomp/loop-5.C

raw
1 void
2 foo ()
3 {
4 int i = 0;
5 #pragma omp for collapse(2)
6 for (i = 0; i < 16; i++) // { dg-error "the same loop iteration variables 'i' used in multiple associated loops" }
7 for (i = 1; i < 32; i++)
8 ;
9 #pragma omp taskloop collapse(2)
10 for (int j = 0; j < 16; j++) // { dg-error "the same loop iteration variables 'j' used in multiple associated loops" }
11 for (j = 0; j < 16; j++)
12 ;
13 }
14
15 template <int N>
16 void
17 bar ()
18 {
19 int i = 0;
20 #pragma omp for collapse(2)
21 for (i = 0; i < 16; i++) // { dg-error "the same loop iteration variables 'i' used in multiple associated loops" }
22 for (i = 1; i < 32; i++)
23 ;
24 #pragma omp taskloop collapse(2)
25 for (int j = 0; j < 16; j++) // { dg-error "the same loop iteration variables 'j' used in multiple associated loops" }
26 for (j = 0; j < 16; j++)
27 ;
28 }
29
30 template <typename T>
31 void
32 baz ()
33 {
34 T i = 0;
35 #pragma omp for collapse(2) // { dg-error "the same loop iteration variables 'i' used in multiple associated loops" }
36 for (i = 0; i < 16; i++)
37 for (i = 1; i < 32; i++)
38 ;
39 #pragma omp taskloop collapse(2) // { dg-error "the same loop iteration variables 'j' used in multiple associated loops" }
40 for (T j = 0; j < 16; j++)
41 for (j = 0; j < 16; j++)
42 ;
43 }
44
45 void
46 test ()
47 {
48 bar <0> ();
49 baz <int> ();
50 }