642 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=502! Check OpenMP 'if' clause validity for all directives that can have it3 4program main5 integer :: i6 7 ! ----------------------------------------------------------------------------8 ! DISTRIBUTE PARALLEL DO9 ! ----------------------------------------------------------------------------10 !$omp teams11 !$omp distribute parallel do if(.true.)12 do i = 1, 1013 end do14 !$omp end distribute parallel do15 16 !$omp distribute parallel do if(parallel: .true.)17 do i = 1, 1018 end do19 !$omp end distribute parallel do20 21 !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO directive22 !$omp distribute parallel do if(target: .true.)23 do i = 1, 1024 end do25 !$omp end distribute parallel do26 27 !ERROR: At most one IF clause can appear on the DISTRIBUTE PARALLEL DO directive28 !$omp distribute parallel do if(.true.) if(parallel: .false.)29 do i = 1, 1030 end do31 !$omp end distribute parallel do32 !$omp end teams33 34 ! ----------------------------------------------------------------------------35 ! DISTRIBUTE PARALLEL DO SIMD36 ! ----------------------------------------------------------------------------37 !$omp teams38 !$omp distribute parallel do simd if(.true.)39 do i = 1, 1040 end do41 !$omp end distribute parallel do simd42 43 !$omp distribute parallel do simd if(parallel: .true.) if(simd: .false.)44 do i = 1, 1045 end do46 !$omp end distribute parallel do simd47 48 !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO SIMD directive49 !$omp distribute parallel do simd if(target: .true.)50 do i = 1, 1051 end do52 !$omp end distribute parallel do simd53 !$omp end teams54 55 ! ----------------------------------------------------------------------------56 ! DISTRIBUTE SIMD57 ! ----------------------------------------------------------------------------58 !$omp teams59 !$omp distribute simd if(.true.)60 do i = 1, 1061 end do62 !$omp end distribute simd63 64 !$omp distribute simd if(simd: .true.)65 do i = 1, 1066 end do67 !$omp end distribute simd68 69 !ERROR: TARGET is not a constituent of the DISTRIBUTE SIMD directive70 !$omp distribute simd if(target: .true.)71 do i = 1, 1072 end do73 !$omp end distribute simd74 75 !ERROR: At most one IF clause can appear on the DISTRIBUTE SIMD directive76 !$omp distribute simd if(.true.) if(simd: .false.)77 do i = 1, 1078 end do79 !$omp end distribute simd80 !$omp end teams81 82 ! ----------------------------------------------------------------------------83 ! DO SIMD84 ! ----------------------------------------------------------------------------85 !$omp do simd if(.true.)86 do i = 1, 1087 end do88 !$omp end do simd89 90 !$omp do simd if(simd: .true.)91 do i = 1, 1092 end do93 !$omp end do simd94 95 !ERROR: TARGET is not a constituent of the DO SIMD directive96 !$omp do simd if(target: .true.)97 do i = 1, 1098 end do99 !$omp end do simd100 101 !ERROR: At most one IF clause can appear on the DO SIMD directive102 !$omp do simd if(.true.) if(simd: .false.)103 do i = 1, 10104 end do105 !$omp end do simd106 107 ! ----------------------------------------------------------------------------108 ! PARALLEL109 ! ----------------------------------------------------------------------------110 !$omp parallel if(.true.)111 !$omp end parallel112 113 !$omp parallel if(parallel: .true.)114 !$omp end parallel115 116 !ERROR: TARGET is not a constituent of the PARALLEL directive117 !$omp parallel if(target: .true.)118 !$omp end parallel119 120 !ERROR: At most one IF clause can appear on the PARALLEL directive121 !$omp parallel if(.true.) if(parallel: .false.)122 !$omp end parallel123 124 ! ----------------------------------------------------------------------------125 ! PARALLEL DO126 ! ----------------------------------------------------------------------------127 !$omp parallel do if(.true.)128 do i = 1, 10129 end do130 !$omp end parallel do131 132 !$omp parallel do if(parallel: .true.)133 do i = 1, 10134 end do135 !$omp end parallel do136 137 !ERROR: TARGET is not a constituent of the PARALLEL DO directive138 !$omp parallel do if(target: .true.)139 do i = 1, 10140 end do141 !$omp end parallel do142 143 !ERROR: At most one IF clause can appear on the PARALLEL DO directive144 !$omp parallel do if(.true.) if(parallel: .false.)145 do i = 1, 10146 end do147 !$omp end parallel do148 149 ! ----------------------------------------------------------------------------150 ! PARALLEL DO SIMD151 ! ----------------------------------------------------------------------------152 !$omp parallel do simd if(.true.)153 do i = 1, 10154 end do155 !$omp end parallel do simd156 157 !$omp parallel do simd if(parallel: .true.) if(simd: .false.)158 do i = 1, 10159 end do160 !$omp end parallel do simd161 162 !ERROR: TARGET is not a constituent of the PARALLEL DO SIMD directive163 !$omp parallel do simd if(target: .true.)164 do i = 1, 10165 end do166 !$omp end parallel do simd167 168 ! ----------------------------------------------------------------------------169 ! PARALLEL SECTIONS170 ! ----------------------------------------------------------------------------171 !$omp parallel sections if(.true.)172 !$omp end parallel sections173 174 !$omp parallel sections if(parallel: .true.)175 !$omp end parallel sections176 177 !ERROR: TARGET is not a constituent of the PARALLEL SECTIONS directive178 !$omp parallel sections if(target: .true.)179 !$omp end parallel sections180 181 !ERROR: At most one IF clause can appear on the PARALLEL SECTIONS directive182 !$omp parallel sections if(.true.) if(parallel: .false.)183 !$omp end parallel sections184 185 ! ----------------------------------------------------------------------------186 ! PARALLEL WORKSHARE187 ! ----------------------------------------------------------------------------188 !$omp parallel workshare if(.true.)189 !$omp end parallel workshare190 191 !$omp parallel workshare if(parallel: .true.)192 !$omp end parallel workshare193 194 !ERROR: TARGET is not a constituent of the PARALLEL WORKSHARE directive195 !$omp parallel workshare if(target: .true.)196 !$omp end parallel workshare197 198 !ERROR: At most one IF clause can appear on the PARALLEL WORKSHARE directive199 !$omp parallel workshare if(.true.) if(parallel: .false.)200 !$omp end parallel workshare201 202 ! ----------------------------------------------------------------------------203 ! SIMD204 ! ----------------------------------------------------------------------------205 !$omp simd if(.true.)206 do i = 1, 10207 end do208 !$omp end simd209 210 !$omp simd if(simd: .true.)211 do i = 1, 10212 end do213 !$omp end simd214 215 !ERROR: TARGET is not a constituent of the SIMD directive216 !$omp simd if(target: .true.)217 do i = 1, 10218 end do219 !$omp end simd220 221 !ERROR: At most one IF clause can appear on the SIMD directive222 !$omp simd if(.true.) if(simd: .false.)223 do i = 1, 10224 end do225 !$omp end simd226 227 ! ----------------------------------------------------------------------------228 ! TARGET229 ! ----------------------------------------------------------------------------230 !$omp target if(.true.)231 !$omp end target232 233 !$omp target if(target: .true.)234 !$omp end target235 236 !ERROR: PARALLEL is not a constituent of the TARGET directive237 !$omp target if(parallel: .true.)238 !$omp end target239 240 !ERROR: At most one IF clause can appear on the TARGET directive241 !$omp target if(.true.) if(target: .false.)242 !$omp end target243 244 ! ----------------------------------------------------------------------------245 ! TARGET DATA246 ! ----------------------------------------------------------------------------247 !$omp target data map(tofrom: i) if(.true.)248 !$omp end target data249 250 !$omp target data map(tofrom: i) if(target data: .true.)251 !$omp end target data252 253 !ERROR: TARGET is not a constituent of the TARGET DATA directive254 !$omp target data map(tofrom: i) if(target: .true.)255 !$omp end target data256 257 !ERROR: At most one IF clause can appear on the TARGET DATA directive258 !$omp target data map(tofrom: i) if(.true.) if(target data: .false.)259 !$omp end target data260 261 ! ----------------------------------------------------------------------------262 ! TARGET ENTER DATA263 ! ----------------------------------------------------------------------------264 !$omp target enter data map(to: i) if(.true.)265 266 !$omp target enter data map(to: i) if(target enter data: .true.)267 268 !ERROR: TARGET is not a constituent of the TARGET ENTER DATA directive269 !$omp target enter data map(to: i) if(target: .true.)270 271 !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive272 !$omp target enter data map(to: i) if(.true.) if(target enter data: .false.)273 274 ! ----------------------------------------------------------------------------275 ! TARGET EXIT DATA276 ! ----------------------------------------------------------------------------277 !$omp target exit data map(from: i) if(.true.)278 279 !$omp target exit data map(from: i) if(target exit data: .true.)280 281 !ERROR: TARGET is not a constituent of the TARGET EXIT DATA directive282 !$omp target exit data map(from: i) if(target: .true.)283 284 !ERROR: At most one IF clause can appear on the TARGET EXIT DATA directive285 !$omp target exit data map(from: i) if(.true.) if(target exit data: .false.)286 287 ! ----------------------------------------------------------------------------288 ! TARGET PARALLEL289 ! ----------------------------------------------------------------------------290 !$omp target parallel if(.true.)291 !$omp end target parallel292 293 !$omp target parallel if(target: .true.) if(parallel: .false.)294 !$omp end target parallel295 296 !ERROR: SIMD is not a constituent of the TARGET PARALLEL directive297 !$omp target parallel if(simd: .true.)298 !$omp end target parallel299 300 ! ----------------------------------------------------------------------------301 ! TARGET PARALLEL DO302 ! ----------------------------------------------------------------------------303 !$omp target parallel do if(.true.)304 do i = 1, 10305 end do306 !$omp end target parallel do307 308 !$omp target parallel do if(target: .true.) if(parallel: .false.)309 do i = 1, 10310 end do311 !$omp end target parallel do312 313 !ERROR: SIMD is not a constituent of the TARGET PARALLEL DO directive314 !$omp target parallel do if(simd: .true.)315 do i = 1, 10316 end do317 !$omp end target parallel do318 319 ! ----------------------------------------------------------------------------320 ! TARGET PARALLEL DO SIMD321 ! ----------------------------------------------------------------------------322 !$omp target parallel do simd if(.true.)323 do i = 1, 10324 end do325 !$omp end target parallel do simd326 327 !$omp target parallel do simd if(target: .true.) if(parallel: .false.) &328 !$omp& if(simd: .true.)329 do i = 1, 10330 end do331 !$omp end target parallel do simd332 333 !ERROR: TEAMS is not a constituent of the TARGET PARALLEL DO SIMD directive334 !$omp target parallel do simd if(teams: .true.)335 do i = 1, 10336 end do337 !$omp end target parallel do simd338 339 ! ----------------------------------------------------------------------------340 ! TARGET SIMD341 ! ----------------------------------------------------------------------------342 !$omp target simd if(.true.)343 do i = 1, 10344 end do345 !$omp end target simd346 347 !$omp target simd if(target: .true.) if(simd: .false.)348 do i = 1, 10349 end do350 !$omp end target simd351 352 !ERROR: PARALLEL is not a constituent of the TARGET SIMD directive353 !$omp target simd if(parallel: .true.)354 do i = 1, 10355 end do356 !$omp end target simd357 358 ! ----------------------------------------------------------------------------359 ! TARGET TEAMS360 ! ----------------------------------------------------------------------------361 !$omp target teams if(.true.)362 !$omp end target teams363 364 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52365 !$omp target teams if(target: .true.) if(teams: .false.)366 !$omp end target teams367 368 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS directive369 !$omp target teams if(parallel: .true.)370 !$omp end target teams371 372 ! ----------------------------------------------------------------------------373 ! TARGET TEAMS DISTRIBUTE374 ! ----------------------------------------------------------------------------375 !$omp target teams distribute if(.true.)376 do i = 1, 10377 end do378 !$omp end target teams distribute379 380 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52381 !$omp target teams distribute if(target: .true.) if(teams: .false.)382 do i = 1, 10383 end do384 !$omp end target teams distribute385 386 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE directive387 !$omp target teams distribute if(parallel: .true.)388 do i = 1, 10389 end do390 !$omp end target teams distribute391 392 ! ----------------------------------------------------------------------------393 ! TARGET TEAMS DISTRIBUTE PARALLEL DO394 ! ----------------------------------------------------------------------------395 !$omp target teams distribute parallel do if(.true.)396 do i = 1, 10397 end do398 !$omp end target teams distribute parallel do399 400 !$omp target teams distribute parallel do &401 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52402 !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.)403 do i = 1, 10404 end do405 !$omp end target teams distribute parallel do406 407 !ERROR: SIMD is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO directive408 !$omp target teams distribute parallel do if(simd: .true.)409 do i = 1, 10410 end do411 !$omp end target teams distribute parallel do412 413 ! ----------------------------------------------------------------------------414 ! TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD415 ! ----------------------------------------------------------------------------416 !$omp target teams distribute parallel do simd if(.true.)417 do i = 1, 10418 end do419 !$omp end target teams distribute parallel do simd420 421 !$omp target teams distribute parallel do simd &422 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52423 !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.) &424 !$omp& if(simd: .false.)425 do i = 1, 10426 end do427 !$omp end target teams distribute parallel do simd428 429 !ERROR: TASK is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive430 !$omp target teams distribute parallel do simd if(task: .true.)431 do i = 1, 10432 end do433 !$omp end target teams distribute parallel do simd434 435 ! ----------------------------------------------------------------------------436 ! TARGET TEAMS DISTRIBUTE SIMD437 ! ----------------------------------------------------------------------------438 !$omp target teams distribute simd if(.true.)439 do i = 1, 10440 end do441 !$omp end target teams distribute simd442 443 !$omp target teams distribute simd &444 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52445 !$omp& if(target: .true.) if(teams: .false.) if(simd: .true.)446 do i = 1, 10447 end do448 !$omp end target teams distribute simd449 450 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE SIMD directive451 !$omp target teams distribute simd if(parallel: .true.)452 do i = 1, 10453 end do454 !$omp end target teams distribute simd455 456 ! ----------------------------------------------------------------------------457 ! TARGET UPDATE458 ! ----------------------------------------------------------------------------459 !$omp target update to(i) if(.true.)460 461 !$omp target update to(i) if(target update: .true.)462 463 !ERROR: TARGET is not a constituent of the TARGET UPDATE directive464 !$omp target update to(i) if(target: .true.)465 466 !ERROR: At most one IF clause can appear on the TARGET UPDATE directive467 !$omp target update to(i) if(.true.) if(target update: .false.)468 469 ! ----------------------------------------------------------------------------470 ! TASK471 ! ----------------------------------------------------------------------------472 !$omp task if(.true.)473 !$omp end task474 475 !$omp task if(task: .true.)476 !$omp end task477 478 !ERROR: TARGET is not a constituent of the TASK directive479 !$omp task if(target: .true.)480 !$omp end task481 482 !ERROR: At most one IF clause can appear on the TASK directive483 !$omp task if(.true.) if(task: .false.)484 !$omp end task485 486 ! ----------------------------------------------------------------------------487 ! TASKLOOP488 ! ----------------------------------------------------------------------------489 !$omp taskloop if(.true.)490 do i = 1, 10491 end do492 !$omp end taskloop493 494 !$omp taskloop if(taskloop: .true.)495 do i = 1, 10496 end do497 !$omp end taskloop498 499 !ERROR: TARGET is not a constituent of the TASKLOOP directive500 !$omp taskloop if(target: .true.)501 do i = 1, 10502 end do503 !$omp end taskloop504 505 !ERROR: At most one IF clause can appear on the TASKLOOP directive506 !$omp taskloop if(.true.) if(taskloop: .false.)507 do i = 1, 10508 end do509 !$omp end taskloop510 511 ! ----------------------------------------------------------------------------512 ! TASKLOOP SIMD513 ! ----------------------------------------------------------------------------514 !$omp taskloop simd if(.true.)515 do i = 1, 10516 end do517 !$omp end taskloop simd518 519 !$omp taskloop simd if(taskloop: .true.) if(simd: .false.)520 do i = 1, 10521 end do522 !$omp end taskloop simd523 524 !ERROR: TARGET is not a constituent of the TASKLOOP SIMD directive525 !$omp taskloop simd if(target: .true.)526 do i = 1, 10527 end do528 !$omp end taskloop simd529 530 ! ----------------------------------------------------------------------------531 ! TEAMS532 ! ----------------------------------------------------------------------------533 !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52534 !$omp teams if(.true.)535 !$omp end teams536 537 !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52538 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52539 !$omp teams if(teams: .true.)540 !$omp end teams541 542 !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52543 !ERROR: TARGET is not a constituent of the TEAMS directive544 !$omp teams if(target: .true.)545 !$omp end teams546 547 !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52548 !ERROR: IF clause is not allowed on directive TEAMS in OpenMP v5.0, try -fopenmp-version=52549 !ERROR: At most one IF clause can appear on the TEAMS directive550 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52551 !$omp teams if(.true.) if(teams: .false.)552 !$omp end teams553 554 ! ----------------------------------------------------------------------------555 ! TEAMS DISTRIBUTE556 ! ----------------------------------------------------------------------------557 !$omp teams distribute if(.true.)558 do i = 1, 10559 end do560 !$omp end teams distribute561 562 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52563 !$omp teams distribute if(teams: .true.)564 do i = 1, 10565 end do566 !$omp end teams distribute567 568 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE directive569 !$omp teams distribute if(target: .true.)570 do i = 1, 10571 end do572 !$omp end teams distribute573 574 !ERROR: At most one IF clause can appear on the TEAMS DISTRIBUTE directive575 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52576 !$omp teams distribute if(.true.) if(teams: .true.)577 do i = 1, 10578 end do579 !$omp end teams distribute580 581 ! ----------------------------------------------------------------------------582 ! TEAMS DISTRIBUTE PARALLEL DO583 ! ----------------------------------------------------------------------------584 !$omp teams distribute parallel do if(.true.)585 do i = 1, 10586 end do587 !$omp end teams distribute parallel do588 589 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52590 !$omp teams distribute parallel do if(teams: .true.) if(parallel: .false.)591 do i = 1, 10592 end do593 !$omp end teams distribute parallel do594 595 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO directive596 !$omp teams distribute parallel do if(target: .true.)597 do i = 1, 10598 end do599 !$omp end teams distribute parallel do600 601 ! ----------------------------------------------------------------------------602 ! TEAMS DISTRIBUTE PARALLEL DO SIMD603 ! ----------------------------------------------------------------------------604 !$omp teams distribute parallel do simd if(.true.)605 do i = 1, 10606 end do607 !$omp end teams distribute parallel do simd608 609 !$omp teams distribute parallel do simd &610 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52611 !$omp& if(teams: .true.) if(parallel: .true.) if(simd: .true.)612 do i = 1, 10613 end do614 !$omp end teams distribute parallel do simd615 616 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO SIMD directive617 !$omp teams distribute parallel do simd if(target: .true.)618 do i = 1, 10619 end do620 !$omp end teams distribute parallel do simd621 622 ! ----------------------------------------------------------------------------623 ! TEAMS DISTRIBUTE SIMD624 ! ----------------------------------------------------------------------------625 !$omp teams distribute simd if(.true.)626 do i = 1, 10627 end do628 !$omp end teams distribute simd629 630 !ERROR: TEAMS is not allowed as 'directive-name-modifier' in OpenMP v5.0, try -fopenmp-version=52631 !$omp teams distribute simd if(teams: .true.) if(simd: .true.)632 do i = 1, 10633 end do634 !$omp end teams distribute simd635 636 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE SIMD directive637 !$omp teams distribute simd if(target: .true.)638 do i = 1, 10639 end do640 !$omp end teams distribute simd641end program main642