Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / do13.f90
blob6e9d1dddade4c02db14c23f78068f54ac11918e8
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.7.1 Loop Construct
5 program omp
6 integer i, j, k
8 !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.
9 !$omp do collapse(3)
10 do i = 0, 10
11 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
12 cycle
13 do j = 0, 10
14 do k = 0, 10
15 print *, i, j, k
16 end do
17 end do
18 end do
19 !$omp end do
21 !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.
22 !$omp do collapse(3)
23 do i = 0, 10
24 do j = 0, 10
25 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
26 cycle
27 do k = 0, 10
28 print *, i, j, k
29 end do
30 end do
31 end do
32 !$omp end do
34 !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.
35 !$omp do collapse(2)
36 do i = 0, 10
37 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
38 cycle
39 do j = 0, 10
40 do k = 0, 10
41 print *, i, j, k
42 end do
43 end do
44 end do
45 !$omp end do
48 !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.
49 !$omp do collapse(2)
50 foo: do i = 0, 10
51 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
52 cycle foo
53 do j = 0, 10
54 do k = 0, 10
55 print *, i, j, k
56 end do
57 end do
58 end do foo
59 !$omp end do
62 !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.
63 !$omp do collapse(3)
64 do 60 i=1,10
65 do j=1,10
66 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
67 cycle
68 do k=1,10
69 print *,i
70 end do
71 end do
72 60 continue
73 !$omp end do
75 !$omp do collapse(3)
76 foo: do i = 0, 10
77 foo1: do j = 0, 10
78 foo2: do k = 0, 10
79 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
80 cycle foo
81 print *, i, j, k
82 end do foo2
83 end do foo1
84 end do foo
85 !$omp end do
87 !$omp do collapse(3)
88 foo: do i = 0, 10
89 foo1: do j = 0, 10
90 foo2: do k = 0, 10
91 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
92 cycle foo1
93 print *, i, j, k
94 end do foo2
95 end do foo1
96 end do foo
97 !$omp end do
100 !$omp do collapse(2)
101 foo: do i = 0, 10
102 foo1: do j = 0, 10
103 foo2: do k = 0, 10
104 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
105 cycle foo
106 print *, i, j, k
107 end do foo2
108 end do foo1
109 end do foo
110 !$omp end do
113 !$omp do collapse(2)
114 foo: do i = 0, 10
115 foo1: do j = 0, 10
116 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
117 cycle foo
118 foo2: do k = 0, 10
119 print *, i, j, k
120 end do foo2
121 end do foo1
122 end do foo
123 !$omp end do
125 !$omp do ordered(2)
126 foo: do i = 0, 10
127 foo1: do j = 0, 10
128 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
129 cycle foo
130 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
131 !$omp do collapse(1)
132 foo2: do k = 0, 10
133 print *, i, j, k
134 end do foo2
135 !$omp end do
136 end do foo1
137 end do foo
138 !$omp end do
140 !$omp parallel
141 !$omp do collapse(2)
142 foo: do i = 0, 10
143 foo1: do j = 0, 10
144 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
145 cycle foo
146 !$omp parallel
147 !$omp do collapse(2)
148 foo2: do k = 0, 10
149 foo3: do l = 0, 10
150 print *, i, j, k, l
151 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
152 cycle foo2
153 end do foo3
154 end do foo2
155 !$omp end do
156 !$omp end parallel
157 end do foo1
158 end do foo
159 !$omp end do
160 !$omp end parallel
162 !$omp parallel
163 !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.
164 !$omp parallel do ordered(3) collapse(2)
165 foo: do i = 0, 10
166 foo1: do j = 0, 10
167 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
168 cycle foo
169 !$omp parallel
170 !$omp parallel do collapse(2)
171 foo2: do k = 0, 10
172 foo3: do l = 0, 10
173 print *, i, j, k, l
174 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
175 cycle foo2
176 end do foo3
177 end do foo2
178 !$omp end parallel do
179 !$omp end parallel
180 end do foo1
181 end do foo
182 !$omp end parallel do
183 !$omp end parallel
185 end program omp