[LLVM] Fix Maintainers.md formatting (NFC)
[llvm-project.git] / flang / test / Semantics / OpenMP / do08.f90
blob5143dff0dd315368edef16ef240d1e11ed0bff16
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.7.1 Loop Construct
5 program omp
6 integer i, j, k
7 logical cond(10,10,10)
8 cond = .false.
10 !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.
11 !$omp do collapse(3)
12 do i = 0, 10
13 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
14 if (i .lt. 1) cycle
15 do j = 0, 10
16 do k = 0, 10
17 print *, i, j, k
18 end do
19 end do
20 end do
21 !$omp end do
23 !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.
24 !$omp do collapse(3)
25 do i = 0, 10
26 do j = 0, 10
27 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
28 if (i .lt. 1) cycle
29 do k = 0, 10
30 print *, i, j, k
31 end do
32 end do
33 end do
34 !$omp end do
36 !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.
37 !$omp do collapse(2)
38 do i = 0, 10
39 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
40 if (i .lt. 1) cycle
41 do j = 0, 10
42 do k = 0, 10
43 print *, i, j, k
44 end do
45 end do
46 end do
47 !$omp end do
50 !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.
51 !$omp do collapse(2)
52 foo: do i = 0, 10
53 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
54 if (i .lt. 1) cycle foo
55 do j = 0, 10
56 do k = 0, 10
57 print *, i, j, k
58 end do
59 end do
60 end do foo
61 !$omp end do
64 !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.
65 !$omp do collapse(3)
66 do 60 i=2,200,2
67 do j=1,10
68 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
69 if(i==100) cycle
70 do k=1,10
71 print *,i
72 end do
73 end do
74 60 continue
75 !$omp end do
77 !$omp do collapse(3)
78 foo: do i = 0, 10
79 foo1: do j = 0, 10
80 foo2: do k = 0, 10
81 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
82 if (k .lt. 1) cycle foo
83 print *, i, j, k
84 end do foo2
85 end do foo1
86 end do foo
87 !$omp end do
89 !$omp do collapse(3)
90 foo: do i = 0, 10
91 foo1: do j = 0, 10
92 foo2: do k = 0, 10
93 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
94 if (k .lt. 1) cycle foo1
95 print *, i, j, k
96 end do foo2
97 end do foo1
98 end do foo
99 !$omp end do
102 !$omp do collapse(2)
103 foo: do i = 0, 10
104 foo1: do j = 0, 10
105 foo2: do k = 0, 10
106 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
107 if (k .lt. 1) cycle foo
108 print *, i, j, k
109 end do foo2
110 end do foo1
111 end do foo
112 !$omp end do
115 !$omp do ordered(2)
116 foo: do i = 0, 10
117 foo1: do j = 0, 10
118 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
119 if (k .lt. 1) cycle foo
120 foo2: do k = 0, 10
121 print *, i, j, k
122 end do foo2
123 end do foo1
124 end do foo
125 !$omp end do
127 !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.
128 !$omp do collapse(2) ordered(3)
129 foo: do i = 0, 10
130 foo1: do j = 0, 10
131 !ERROR: CYCLE statement to non-innermost associated loop of an OpenMP DO construct
132 if (k .lt. 1) cycle foo
133 foo2: do k = 0, 10
134 print *, i, j, k
135 end do foo2
136 end do foo1
137 end do foo
138 !$omp end do
140 !$omp do collapse(3)
141 loopk: do k=1,10
142 loopj: do j=1,10
143 loopi: do i=1,10
144 ifi : if (.true.) then
145 !ERROR: EXIT statement terminates associated loop of an OpenMP DO construct
146 if (cond(i,j,k)) exit
147 if (cond(i,j,k)) exit ifi
148 !ERROR: EXIT statement terminates associated loop of an OpenMP DO construct
149 if (cond(i,j,k)) exit loopi
150 !ERROR: EXIT statement terminates associated loop of an OpenMP DO construct
151 if (cond(i,j,k)) exit loopj
152 end if ifi
153 end do loopi
154 end do loopj
155 end do loopk
156 !$omp end do
158 !$omp do collapse(2)
159 loopk: do k=1,10
160 loopj: do j=1,10
161 do i=1,10
162 end do
163 !ERROR: EXIT statement terminates associated loop of an OpenMP DO construct
164 if (cond(i,j,k)) exit
165 end do loopj
166 end do loopk
167 !$omp end do
169 end program omp