1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52
2 ! Check OpenMP 'if' clause validity for all directives that can have it
7 ! ----------------------------------------------------------------------------
8 ! DISTRIBUTE PARALLEL DO
9 ! ----------------------------------------------------------------------------
11 !$omp distribute parallel do if(.true.)
14 !$omp end distribute parallel do
16 !$omp distribute parallel do if(parallel: .true.)
19 !$omp end distribute parallel do
21 !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO directive
22 !$omp distribute parallel do if(target: .true.)
25 !$omp end distribute parallel do
27 !ERROR: At most one IF clause can appear on the DISTRIBUTE PARALLEL DO directive
28 !$omp distribute parallel do if(.true.) if(parallel: .false.)
31 !$omp end distribute parallel do
34 ! ----------------------------------------------------------------------------
35 ! DISTRIBUTE PARALLEL DO SIMD
36 ! ----------------------------------------------------------------------------
38 !$omp distribute parallel do simd if(.true.)
41 !$omp end distribute parallel do simd
43 !$omp distribute parallel do simd if(parallel: .true.) if(simd: .false.)
46 !$omp end distribute parallel do simd
48 !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO SIMD directive
49 !$omp distribute parallel do simd if(target: .true.)
52 !$omp end distribute parallel do simd
55 ! ----------------------------------------------------------------------------
57 ! ----------------------------------------------------------------------------
59 !$omp distribute simd if(.true.)
62 !$omp end distribute simd
64 !$omp distribute simd if(simd: .true.)
67 !$omp end distribute simd
69 !ERROR: TARGET is not a constituent of the DISTRIBUTE SIMD directive
70 !$omp distribute simd if(target: .true.)
73 !$omp end distribute simd
75 !ERROR: At most one IF clause can appear on the DISTRIBUTE SIMD directive
76 !$omp distribute simd if(.true.) if(simd: .false.)
79 !$omp end distribute simd
82 ! ----------------------------------------------------------------------------
84 ! ----------------------------------------------------------------------------
85 !$omp do simd if(.true.)
90 !$omp do simd if(simd: .true.)
95 !ERROR: TARGET is not a constituent of the DO SIMD directive
96 !$omp do simd if(target: .true.)
101 !ERROR: At most one IF clause can appear on the DO SIMD directive
102 !$omp do simd if(.true.) if(simd: .false.)
107 ! ----------------------------------------------------------------------------
109 ! ----------------------------------------------------------------------------
110 !$omp parallel if(.true.)
113 !$omp parallel if(parallel: .true.)
116 !ERROR: TARGET is not a constituent of the PARALLEL directive
117 !$omp parallel if(target: .true.)
120 !ERROR: At most one IF clause can appear on the PARALLEL directive
121 !$omp parallel if(.true.) if(parallel: .false.)
124 ! ----------------------------------------------------------------------------
126 ! ----------------------------------------------------------------------------
127 !$omp parallel do if(.true.)
130 !$omp end parallel do
132 !$omp parallel do if(parallel: .true.)
135 !$omp end parallel do
137 !ERROR: TARGET is not a constituent of the PARALLEL DO directive
138 !$omp parallel do if(target: .true.)
141 !$omp end parallel do
143 !ERROR: At most one IF clause can appear on the PARALLEL DO directive
144 !$omp parallel do if(.true.) if(parallel: .false.)
147 !$omp end parallel do
149 ! ----------------------------------------------------------------------------
151 ! ----------------------------------------------------------------------------
152 !$omp parallel do simd if(.true.)
155 !$omp end parallel do simd
157 !$omp parallel do simd if(parallel: .true.) if(simd: .false.)
160 !$omp end parallel do simd
162 !ERROR: TARGET is not a constituent of the PARALLEL DO SIMD directive
163 !$omp parallel do simd if(target: .true.)
166 !$omp end parallel do simd
168 ! ----------------------------------------------------------------------------
170 ! ----------------------------------------------------------------------------
171 !$omp parallel sections if(.true.)
172 !$omp end parallel sections
174 !$omp parallel sections if(parallel: .true.)
175 !$omp end parallel sections
177 !ERROR: TARGET is not a constituent of the PARALLEL SECTIONS directive
178 !$omp parallel sections if(target: .true.)
179 !$omp end parallel sections
181 !ERROR: At most one IF clause can appear on the PARALLEL SECTIONS directive
182 !$omp parallel sections if(.true.) if(parallel: .false.)
183 !$omp end parallel sections
185 ! ----------------------------------------------------------------------------
187 ! ----------------------------------------------------------------------------
188 !$omp parallel workshare if(.true.)
189 !$omp end parallel workshare
191 !$omp parallel workshare if(parallel: .true.)
192 !$omp end parallel workshare
194 !ERROR: TARGET is not a constituent of the PARALLEL WORKSHARE directive
195 !$omp parallel workshare if(target: .true.)
196 !$omp end parallel workshare
198 !ERROR: At most one IF clause can appear on the PARALLEL WORKSHARE directive
199 !$omp parallel workshare if(.true.) if(parallel: .false.)
200 !$omp end parallel workshare
202 ! ----------------------------------------------------------------------------
204 ! ----------------------------------------------------------------------------
205 !$omp simd if(.true.)
210 !$omp simd if(simd: .true.)
215 !ERROR: TARGET is not a constituent of the SIMD directive
216 !$omp simd if(target: .true.)
221 !ERROR: At most one IF clause can appear on the SIMD directive
222 !$omp simd if(.true.) if(simd: .false.)
227 ! ----------------------------------------------------------------------------
229 ! ----------------------------------------------------------------------------
230 !$omp target if(.true.)
233 !$omp target if(target: .true.)
236 !ERROR: PARALLEL is not a constituent of the TARGET directive
237 !$omp target if(parallel: .true.)
240 !ERROR: At most one IF clause can appear on the TARGET directive
241 !$omp target if(.true.) if(target: .false.)
244 ! ----------------------------------------------------------------------------
246 ! ----------------------------------------------------------------------------
247 !$omp target data map(tofrom: i) if(.true.)
248 !$omp end target data
250 !$omp target data map(tofrom: i) if(target data: .true.)
251 !$omp end target data
253 !ERROR: TARGET is not a constituent of the TARGET DATA directive
254 !$omp target data map(tofrom: i) if(target: .true.)
255 !$omp end target data
257 !ERROR: At most one IF clause can appear on the TARGET DATA directive
258 !$omp target data map(tofrom: i) if(.true.) if(target data: .false.)
259 !$omp end target data
261 ! ----------------------------------------------------------------------------
263 ! ----------------------------------------------------------------------------
264 !$omp target enter data map(to: i) if(.true.)
266 !$omp target enter data map(to: i) if(target enter data: .true.)
268 !ERROR: TARGET is not a constituent of the TARGET ENTER DATA directive
269 !$omp target enter data map(to: i) if(target: .true.)
271 !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive
272 !$omp target enter data map(to: i) if(.true.) if(target enter data: .false.)
274 ! ----------------------------------------------------------------------------
276 ! ----------------------------------------------------------------------------
277 !$omp target exit data map(from: i) if(.true.)
279 !$omp target exit data map(from: i) if(target exit data: .true.)
281 !ERROR: TARGET is not a constituent of the TARGET EXIT DATA directive
282 !$omp target exit data map(from: i) if(target: .true.)
284 !ERROR: At most one IF clause can appear on the TARGET EXIT DATA directive
285 !$omp target exit data map(from: i) if(.true.) if(target exit data: .false.)
287 ! ----------------------------------------------------------------------------
289 ! ----------------------------------------------------------------------------
290 !$omp target parallel if(.true.)
291 !$omp end target parallel
293 !$omp target parallel if(target: .true.) if(parallel: .false.)
294 !$omp end target parallel
296 !ERROR: SIMD is not a constituent of the TARGET PARALLEL directive
297 !$omp target parallel if(simd: .true.)
298 !$omp end target parallel
300 ! ----------------------------------------------------------------------------
302 ! ----------------------------------------------------------------------------
303 !$omp target parallel do if(.true.)
306 !$omp end target parallel do
308 !$omp target parallel do if(target: .true.) if(parallel: .false.)
311 !$omp end target parallel do
313 !ERROR: SIMD is not a constituent of the TARGET PARALLEL DO directive
314 !$omp target parallel do if(simd: .true.)
317 !$omp end target parallel do
319 ! ----------------------------------------------------------------------------
320 ! TARGET PARALLEL DO SIMD
321 ! ----------------------------------------------------------------------------
322 !$omp target parallel do simd if(.true.)
325 !$omp end target parallel do simd
327 !$omp target parallel do simd if(target: .true.) if(parallel: .false.) &
328 !$omp& if(simd: .true.)
331 !$omp end target parallel do simd
333 !ERROR: TEAMS is not a constituent of the TARGET PARALLEL DO SIMD directive
334 !$omp target parallel do simd if(teams: .true.)
337 !$omp end target parallel do simd
339 ! ----------------------------------------------------------------------------
341 ! ----------------------------------------------------------------------------
342 !$omp target simd if(.true.)
345 !$omp end target simd
347 !$omp target simd if(target: .true.) if(simd: .false.)
350 !$omp end target simd
352 !ERROR: PARALLEL is not a constituent of the TARGET SIMD directive
353 !$omp target simd if(parallel: .true.)
356 !$omp end target simd
358 ! ----------------------------------------------------------------------------
360 ! ----------------------------------------------------------------------------
361 !$omp target teams if(.true.)
362 !$omp end target teams
364 !$omp target teams if(target: .true.) if(teams: .false.)
365 !$omp end target teams
367 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS directive
368 !$omp target teams if(parallel: .true.)
369 !$omp end target teams
371 ! ----------------------------------------------------------------------------
372 ! TARGET TEAMS DISTRIBUTE
373 ! ----------------------------------------------------------------------------
374 !$omp target teams distribute if(.true.)
377 !$omp end target teams distribute
379 !$omp target teams distribute if(target: .true.) if(teams: .false.)
382 !$omp end target teams distribute
384 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE directive
385 !$omp target teams distribute if(parallel: .true.)
388 !$omp end target teams distribute
390 ! ----------------------------------------------------------------------------
391 ! TARGET TEAMS DISTRIBUTE PARALLEL DO
392 ! ----------------------------------------------------------------------------
393 !$omp target teams distribute parallel do if(.true.)
396 !$omp end target teams distribute parallel do
398 !$omp target teams distribute parallel do &
399 !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.)
402 !$omp end target teams distribute parallel do
404 !ERROR: SIMD is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
405 !$omp target teams distribute parallel do if(simd: .true.)
408 !$omp end target teams distribute parallel do
410 ! ----------------------------------------------------------------------------
411 ! TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD
412 ! ----------------------------------------------------------------------------
413 !$omp target teams distribute parallel do simd if(.true.)
416 !$omp end target teams distribute parallel do simd
418 !$omp target teams distribute parallel do simd &
419 !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.) &
420 !$omp& if(simd: .false.)
423 !$omp end target teams distribute parallel do simd
425 !ERROR: TASK is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
426 !$omp target teams distribute parallel do simd if(task: .true.)
429 !$omp end target teams distribute parallel do simd
431 ! ----------------------------------------------------------------------------
432 ! TARGET TEAMS DISTRIBUTE SIMD
433 ! ----------------------------------------------------------------------------
434 !$omp target teams distribute simd if(.true.)
437 !$omp end target teams distribute simd
439 !$omp target teams distribute simd &
440 !$omp& if(target: .true.) if(teams: .false.) if(simd: .true.)
443 !$omp end target teams distribute simd
445 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE SIMD directive
446 !$omp target teams distribute simd if(parallel: .true.)
449 !$omp end target teams distribute simd
451 ! ----------------------------------------------------------------------------
453 ! ----------------------------------------------------------------------------
454 !$omp target update to(i) if(.true.)
456 !$omp target update to(i) if(target update: .true.)
458 !ERROR: TARGET is not a constituent of the TARGET UPDATE directive
459 !$omp target update to(i) if(target: .true.)
461 !ERROR: At most one IF clause can appear on the TARGET UPDATE directive
462 !$omp target update to(i) if(.true.) if(target update: .false.)
464 ! ----------------------------------------------------------------------------
466 ! ----------------------------------------------------------------------------
467 !$omp task if(.true.)
470 !$omp task if(task: .true.)
473 !ERROR: TARGET is not a constituent of the TASK directive
474 !$omp task if(target: .true.)
477 !ERROR: At most one IF clause can appear on the TASK directive
478 !$omp task if(.true.) if(task: .false.)
481 ! ----------------------------------------------------------------------------
483 ! ----------------------------------------------------------------------------
484 !$omp taskloop if(.true.)
489 !$omp taskloop if(taskloop: .true.)
494 !ERROR: TARGET is not a constituent of the TASKLOOP directive
495 !$omp taskloop if(target: .true.)
500 !ERROR: At most one IF clause can appear on the TASKLOOP directive
501 !$omp taskloop if(.true.) if(taskloop: .false.)
506 ! ----------------------------------------------------------------------------
508 ! ----------------------------------------------------------------------------
509 !$omp taskloop simd if(.true.)
512 !$omp end taskloop simd
514 !$omp taskloop simd if(taskloop: .true.) if(simd: .false.)
517 !$omp end taskloop simd
519 !ERROR: TARGET is not a constituent of the TASKLOOP SIMD directive
520 !$omp taskloop simd if(target: .true.)
523 !$omp end taskloop simd
525 ! ----------------------------------------------------------------------------
527 ! ----------------------------------------------------------------------------
528 !$omp teams if(.true.)
531 !$omp teams if(teams: .true.)
534 !ERROR: TARGET is not a constituent of the TEAMS directive
535 !$omp teams if(target: .true.)
538 !ERROR: At most one IF clause can appear on the TEAMS directive
539 !$omp teams if(.true.) if(teams: .false.)
542 ! ----------------------------------------------------------------------------
544 ! ----------------------------------------------------------------------------
545 !$omp teams distribute if(.true.)
548 !$omp end teams distribute
550 !$omp teams distribute if(teams: .true.)
553 !$omp end teams distribute
555 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE directive
556 !$omp teams distribute if(target: .true.)
559 !$omp end teams distribute
561 !ERROR: At most one IF clause can appear on the TEAMS DISTRIBUTE directive
562 !$omp teams distribute if(.true.) if(teams: .true.)
565 !$omp end teams distribute
567 ! ----------------------------------------------------------------------------
568 ! TEAMS DISTRIBUTE PARALLEL DO
569 ! ----------------------------------------------------------------------------
570 !$omp teams distribute parallel do if(.true.)
573 !$omp end teams distribute parallel do
575 !$omp teams distribute parallel do if(teams: .true.) if(parallel: .false.)
578 !$omp end teams distribute parallel do
580 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO directive
581 !$omp teams distribute parallel do if(target: .true.)
584 !$omp end teams distribute parallel do
586 ! ----------------------------------------------------------------------------
587 ! TEAMS DISTRIBUTE PARALLEL DO SIMD
588 ! ----------------------------------------------------------------------------
589 !$omp teams distribute parallel do simd if(.true.)
592 !$omp end teams distribute parallel do simd
594 !$omp teams distribute parallel do simd &
595 !$omp& if(teams: .true.) if(parallel: .true.) if(simd: .true.)
598 !$omp end teams distribute parallel do simd
600 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO SIMD directive
601 !$omp teams distribute parallel do simd if(target: .true.)
604 !$omp end teams distribute parallel do simd
606 ! ----------------------------------------------------------------------------
607 ! TEAMS DISTRIBUTE SIMD
608 ! ----------------------------------------------------------------------------
609 !$omp teams distribute simd if(.true.)
612 !$omp end teams distribute simd
614 !$omp teams distribute simd if(teams: .true.) if(simd: .true.)
617 !$omp end teams distribute simd
619 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE SIMD directive
620 !$omp teams distribute simd if(target: .true.)
623 !$omp end teams distribute simd