[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / omp-do08.f90
blob65e94df67dea2eb314d5abee8bed7205eded3342
1 ! RUN: %S/test_errors.sh %s %t %flang -fopenmp
2 ! REQUIRES: shell
3 ! OpenMP Version 4.5
4 ! 2.7.1 Loop Construct
6 program omp
7 integer i, j, k
9 !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
10 !$omp do collapse(3)
11 do i = 0, 10
12 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
13 if (i .lt. 1) cycle
14 do j = 0, 10
15 do k = 0, 10
16 print *, i, j, k
17 end do
18 end do
19 end do
20 !$omp end do
22 !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
23 !$omp do collapse(3)
24 do i = 0, 10
25 do j = 0, 10
26 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
27 if (i .lt. 1) cycle
28 do k = 0, 10
29 print *, i, j, k
30 end do
31 end do
32 end do
33 !$omp end do
35 !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
36 !$omp do collapse(2)
37 do i = 0, 10
38 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
39 if (i .lt. 1) cycle
40 do j = 0, 10
41 do k = 0, 10
42 print *, i, j, k
43 end do
44 end do
45 end do
46 !$omp end do
49 !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
50 !$omp do collapse(2)
51 foo: do i = 0, 10
52 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
53 if (i .lt. 1) cycle foo
54 do j = 0, 10
55 do k = 0, 10
56 print *, i, j, k
57 end do
58 end do
59 end do foo
60 !$omp end do
63 !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
64 !$omp do collapse(3)
65 do 60 i=2,200,2
66 do j=1,10
67 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
68 if(i==100) cycle
69 do k=1,10
70 print *,i
71 end do
72 end do
73 60 continue
74 !$omp end do
76 !$omp do collapse(3)
77 foo: do i = 0, 10
78 foo1: do j = 0, 10
79 foo2: do k = 0, 10
80 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
81 if (k .lt. 1) cycle foo
82 print *, i, j, k
83 end do foo2
84 end do foo1
85 end do foo
86 !$omp end do
88 !$omp do collapse(3)
89 foo: do i = 0, 10
90 foo1: do j = 0, 10
91 foo2: do k = 0, 10
92 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
93 if (k .lt. 1) cycle foo1
94 print *, i, j, k
95 end do foo2
96 end do foo1
97 end do foo
98 !$omp end do
101 !$omp do collapse(2)
102 foo: do i = 0, 10
103 foo1: do j = 0, 10
104 foo2: do k = 0, 10
105 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
106 if (k .lt. 1) cycle foo
107 print *, i, j, k
108 end do foo2
109 end do foo1
110 end do foo
111 !$omp end do
114 !$omp do ordered(2)
115 foo: do i = 0, 10
116 foo1: do j = 0, 10
117 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
118 if (k .lt. 1) cycle foo
119 foo2: do k = 0, 10
120 print *, i, j, k
121 end do foo2
122 end do foo1
123 end do foo
124 !$omp end do
126 !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
127 !$omp do collapse(2) ordered(3)
128 foo: do i = 0, 10
129 foo1: do j = 0, 10
130 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
131 if (k .lt. 1) cycle foo
132 foo2: do k = 0, 10
133 print *, i, j, k
134 end do foo2
135 end do foo1
136 end do foo
137 !$omp end do
139 end program omp