[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenMP / omp-nested-cancellation-point.f90
blob5392a31b23312dcd307f9cc3cd39dc324c09c373
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
3 ! OpenMP Version 5.0
4 ! Check OpenMP construct validity for the following directives:
5 ! 2.18.2 Cancellation Point Construct
7 program main
8 integer :: i, N = 10
9 real :: a
11 !ERROR: CANCELLATION POINT TASKGROUP directive is not closely nested inside TASK or TASKLOOP
12 !$omp cancellation point taskgroup
14 !ERROR: CANCELLATION POINT SECTIONS directive is not closely nested inside SECTION or SECTIONS
15 !$omp cancellation point sections
17 !ERROR: CANCELLATION POINT DO directive is not closely nested inside the construct that matches the DO clause type
18 !$omp cancellation point do
20 !ERROR: CANCELLATION POINT PARALLEL directive is not closely nested inside the construct that matches the PARALLEL clause type
21 !$omp cancellation point parallel
23 !$omp parallel
24 !$omp sections
25 !$omp cancellation point sections
26 !$omp section
27 a = 3.14
28 !$omp end sections
29 !$omp end parallel
31 !$omp sections
32 !$omp section
33 !$omp cancellation point sections
34 a = 3.14
35 !$omp end sections
37 !$omp parallel
38 !ERROR: With SECTIONS clause, CANCELLATION POINT construct cannot be closely nested inside PARALLEL construct
39 !$omp cancellation point sections
40 a = 3.14
41 !$omp end parallel
43 !$omp parallel sections
44 !$omp cancellation point sections
45 a = 3.14
46 !$omp end parallel sections
48 !$omp do
49 do i = 1, N
50 a = 3.14
51 !$omp cancellation point do
52 end do
53 !$omp end do
55 !$omp parallel do
56 do i = 1, N
57 a = 3.14
58 !$omp cancellation point do
59 end do
60 !$omp end parallel do
62 !$omp target
63 !$omp teams
64 !$omp distribute parallel do
65 do i = 1, N
66 a = 3.14
67 !$omp cancellation point do
68 end do
69 !$omp end distribute parallel do
70 !$omp end teams
71 !$omp end target
73 !$omp target
74 !$omp teams distribute parallel do
75 do i = 1, N
76 a = 3.14
77 !$omp cancellation point do
78 end do
79 !$omp end teams distribute parallel do
80 !$omp end target
82 !$omp target teams distribute parallel do
83 do i = 1, N
84 a = 3.14
85 !$omp cancellation point do
86 end do
87 !$omp end target teams distribute parallel do
89 !$omp target parallel do
90 do i = 1, N
91 a = 3.14
92 !$omp cancellation point do
93 end do
94 !$omp end target parallel do
96 !$omp parallel
97 do i = 1, N
98 a = 3.14
99 !ERROR: With DO clause, CANCELLATION POINT construct cannot be closely nested inside PARALLEL construct
100 !$omp cancellation point do
101 end do
102 !$omp end parallel
104 !$omp parallel
105 do i = 1, N
106 a = 3.14
107 !$omp cancellation point parallel
108 end do
109 !$omp end parallel
111 !$omp target parallel
112 do i = 1, N
113 a = 3.14
114 !$omp cancellation point parallel
115 end do
116 !$omp end target parallel
118 !$omp target parallel do
119 do i = 1, N
120 a = 3.14
121 !ERROR: With PARALLEL clause, CANCELLATION POINT construct cannot be closely nested inside TARGET PARALLEL DO construct
122 !$omp cancellation point parallel
123 end do
124 !$omp end target parallel do
126 !$omp do
127 do i = 1, N
128 a = 3.14
129 !ERROR: With PARALLEL clause, CANCELLATION POINT construct cannot be closely nested inside DO construct
130 !$omp cancellation point parallel
131 end do
132 !$omp end do
134 contains
135 subroutine sub1()
136 !$omp task
137 !$omp cancellation point taskgroup
138 a = 3.14
139 !$omp end task
141 !$omp taskloop
142 do i = 1, N
143 !$omp parallel
144 !$omp end parallel
145 !$omp cancellation point taskgroup
146 a = 3.14
147 end do
148 !$omp end taskloop
150 !$omp taskloop nogroup
151 do i = 1, N
152 !$omp cancellation point taskgroup
153 a = 3.14
154 end do
156 !$omp parallel
157 !ERROR: With TASKGROUP clause, CANCELLATION POINT construct must be closely nested inside TASK or TASKLOOP construct and CANCELLATION POINT region must be closely nested inside TASKGROUP region
158 !$omp cancellation point taskgroup
159 a = 3.14
160 !$omp end parallel
162 !$omp do
163 do i = 1, N
164 !$omp task
165 !$omp cancellation point taskgroup
166 a = 3.14
167 !$omp end task
168 end do
169 !$omp end do
171 !$omp parallel
172 !$omp taskgroup
173 !$omp task
174 !$omp cancellation point taskgroup
175 a = 3.14
176 !$omp end task
177 !$omp end taskgroup
178 !$omp end parallel
180 !$omp parallel
181 !$omp task
182 !ERROR: With TASKGROUP clause, CANCELLATION POINT construct must be closely nested inside TASK or TASKLOOP construct and CANCELLATION POINT region must be closely nested inside TASKGROUP region
183 !$omp cancellation point taskgroup
184 a = 3.14
185 !$omp end task
186 !$omp end parallel
188 !$omp parallel
189 !$omp do
190 do i = 1, N
191 !$omp task
192 !ERROR: With TASKGROUP clause, CANCELLATION POINT construct must be closely nested inside TASK or TASKLOOP construct and CANCELLATION POINT region must be closely nested inside TASKGROUP region
193 !$omp cancellation point taskgroup
194 a = 3.14
195 !$omp end task
196 end do
197 !$omp end do
198 !$omp end parallel
200 !$omp target parallel
201 !$omp task
202 !ERROR: With TASKGROUP clause, CANCELLATION POINT construct must be closely nested inside TASK or TASKLOOP construct and CANCELLATION POINT region must be closely nested inside TASKGROUP region
203 !$omp cancellation point taskgroup
204 a = 3.14
205 !$omp end task
206 !$omp end target parallel
208 !$omp parallel
209 !$omp taskloop private(j) nogroup
210 do i = 1, N
211 !ERROR: With TASKGROUP clause, CANCELLATION POINT construct must be closely nested inside TASK or TASKLOOP construct and CANCELLATION POINT region must be closely nested inside TASKGROUP region
212 !$omp cancellation point taskgroup
213 a = 3.14
214 end do
215 !$omp end taskloop
216 !$omp end parallel
218 !$omp parallel
219 !$omp taskloop
220 do i = 1, N
221 !$omp cancellation point taskgroup
222 a = 3.14
223 end do
224 !$omp end taskloop
225 !$omp end parallel
227 !$omp parallel
228 !$omp taskgroup
229 !$omp taskloop nogroup
230 do i = 1, N
231 !$omp cancellation point taskgroup
232 a = 3.14
233 end do
234 !$omp end taskloop
235 !$omp end taskgroup
236 !$omp end parallel
238 !$omp target parallel
239 !$omp taskloop nogroup
240 do i = 1, N
241 !ERROR: With TASKGROUP clause, CANCELLATION POINT construct must be closely nested inside TASK or TASKLOOP construct and CANCELLATION POINT region must be closely nested inside TASKGROUP region
242 !$omp cancellation point taskgroup
243 a = 3.14
244 end do
245 !$omp end taskloop
246 !$omp end target parallel
247 end subroutine sub1
249 end program main