1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
4 ! Check OpenMP construct validity for the following directives:
5 ! 2.18.1 Cancel Construct
11 !ERROR: CANCEL TASKGROUP directive is not closely nested inside TASK or TASKLOOP
12 !$omp cancel taskgroup
14 !ERROR: CANCEL SECTIONS directive is not closely nested inside SECTION or SECTIONS
17 !ERROR: CANCEL DO directive is not closely nested inside the construct that matches the DO clause type
20 !ERROR: CANCEL PARALLEL directive is not closely nested inside the construct that matches the PARALLEL clause type
38 !ERROR: With SECTIONS clause, CANCEL construct cannot be closely nested inside PARALLEL construct
43 !$omp parallel sections
46 !$omp end parallel sections
64 !$omp distribute parallel do
69 !$omp end distribute parallel do
74 !$omp teams distribute parallel do
79 !$omp end teams distribute parallel do
82 !$omp target teams distribute parallel do
87 !$omp end target teams distribute parallel do
89 !$omp target parallel do
94 !$omp end target parallel do
99 !ERROR: With DO clause, CANCEL construct cannot be closely nested inside PARALLEL construct
107 !$omp cancel parallel
111 !$omp target parallel
114 !$omp cancel parallel
116 !$omp end target parallel
118 !$omp target parallel do
121 !ERROR: With PARALLEL clause, CANCEL construct cannot be closely nested inside TARGET PARALLEL DO construct
122 !$omp cancel parallel
124 !$omp end target parallel do
129 !ERROR: With PARALLEL clause, CANCEL construct cannot be closely nested inside DO construct
130 !$omp cancel parallel
137 !$omp cancel taskgroup
145 !$omp cancel taskgroup
150 !$omp taskloop nogroup
152 !$omp cancel taskgroup
157 !ERROR: With TASKGROUP clause, CANCEL construct must be closely nested inside TASK or TASKLOOP construct and CANCEL region must be closely nested inside TASKGROUP region
158 !$omp cancel taskgroup
165 !$omp cancel taskgroup
174 !$omp cancel taskgroup
182 !ERROR: With TASKGROUP clause, CANCEL construct must be closely nested inside TASK or TASKLOOP construct and CANCEL region must be closely nested inside TASKGROUP region
183 !$omp cancel taskgroup
192 !ERROR: With TASKGROUP clause, CANCEL construct must be closely nested inside TASK or TASKLOOP construct and CANCEL region must be closely nested inside TASKGROUP region
193 !$omp cancel taskgroup
200 !$omp target parallel
202 !ERROR: With TASKGROUP clause, CANCEL construct must be closely nested inside TASK or TASKLOOP construct and CANCEL region must be closely nested inside TASKGROUP region
203 !$omp cancel taskgroup
206 !$omp end target parallel
209 !$omp taskloop private(j) nogroup
211 !ERROR: With TASKGROUP clause, CANCEL construct must be closely nested inside TASK or TASKLOOP construct and CANCEL region must be closely nested inside TASKGROUP region
212 !$omp cancel taskgroup
221 !$omp cancel taskgroup
229 !$omp taskloop nogroup
231 !$omp cancel taskgroup
238 !$omp target parallel
239 !$omp taskloop nogroup
241 !ERROR: With TASKGROUP clause, CANCEL construct must be closely nested inside TASK or TASKLOOP construct and CANCEL region must be closely nested inside TASKGROUP region
242 !$omp cancel taskgroup
246 !$omp end target parallel