625 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=522! 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 !$omp target teams if(target: .true.) if(teams: .false.)365 !$omp end target teams366 367 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS directive368 !$omp target teams if(parallel: .true.)369 !$omp end target teams370 371 ! ----------------------------------------------------------------------------372 ! TARGET TEAMS DISTRIBUTE373 ! ----------------------------------------------------------------------------374 !$omp target teams distribute if(.true.)375 do i = 1, 10376 end do377 !$omp end target teams distribute378 379 !$omp target teams distribute if(target: .true.) if(teams: .false.)380 do i = 1, 10381 end do382 !$omp end target teams distribute383 384 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE directive385 !$omp target teams distribute if(parallel: .true.)386 do i = 1, 10387 end do388 !$omp end target teams distribute389 390 ! ----------------------------------------------------------------------------391 ! TARGET TEAMS DISTRIBUTE PARALLEL DO392 ! ----------------------------------------------------------------------------393 !$omp target teams distribute parallel do if(.true.)394 do i = 1, 10395 end do396 !$omp end target teams distribute parallel do397 398 !$omp target teams distribute parallel do &399 !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.)400 do i = 1, 10401 end do402 !$omp end target teams distribute parallel do403 404 !ERROR: SIMD is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO directive405 !$omp target teams distribute parallel do if(simd: .true.)406 do i = 1, 10407 end do408 !$omp end target teams distribute parallel do409 410 ! ----------------------------------------------------------------------------411 ! TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD412 ! ----------------------------------------------------------------------------413 !$omp target teams distribute parallel do simd if(.true.)414 do i = 1, 10415 end do416 !$omp end target teams distribute parallel do simd417 418 !$omp target teams distribute parallel do simd &419 !$omp& if(target: .true.) if(teams: .false.) if(parallel: .true.) &420 !$omp& if(simd: .false.)421 do i = 1, 10422 end do423 !$omp end target teams distribute parallel do simd424 425 !ERROR: TASK is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive426 !$omp target teams distribute parallel do simd if(task: .true.)427 do i = 1, 10428 end do429 !$omp end target teams distribute parallel do simd430 431 ! ----------------------------------------------------------------------------432 ! TARGET TEAMS DISTRIBUTE SIMD433 ! ----------------------------------------------------------------------------434 !$omp target teams distribute simd if(.true.)435 do i = 1, 10436 end do437 !$omp end target teams distribute simd438 439 !$omp target teams distribute simd &440 !$omp& if(target: .true.) if(teams: .false.) if(simd: .true.)441 do i = 1, 10442 end do443 !$omp end target teams distribute simd444 445 !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE SIMD directive446 !$omp target teams distribute simd if(parallel: .true.)447 do i = 1, 10448 end do449 !$omp end target teams distribute simd450 451 ! ----------------------------------------------------------------------------452 ! TARGET UPDATE453 ! ----------------------------------------------------------------------------454 !$omp target update to(i) if(.true.)455 456 !$omp target update to(i) if(target update: .true.)457 458 !ERROR: TARGET is not a constituent of the TARGET UPDATE directive459 !$omp target update to(i) if(target: .true.)460 461 !ERROR: At most one IF clause can appear on the TARGET UPDATE directive462 !$omp target update to(i) if(.true.) if(target update: .false.)463 464 ! ----------------------------------------------------------------------------465 ! TASK466 ! ----------------------------------------------------------------------------467 !$omp task if(.true.)468 !$omp end task469 470 !$omp task if(task: .true.)471 !$omp end task472 473 !ERROR: TARGET is not a constituent of the TASK directive474 !$omp task if(target: .true.)475 !$omp end task476 477 !ERROR: At most one IF clause can appear on the TASK directive478 !$omp task if(.true.) if(task: .false.)479 !$omp end task480 481 ! ----------------------------------------------------------------------------482 ! TASKLOOP483 ! ----------------------------------------------------------------------------484 !$omp taskloop if(.true.)485 do i = 1, 10486 end do487 !$omp end taskloop488 489 !$omp taskloop if(taskloop: .true.)490 do i = 1, 10491 end do492 !$omp end taskloop493 494 !ERROR: TARGET is not a constituent of the TASKLOOP directive495 !$omp taskloop if(target: .true.)496 do i = 1, 10497 end do498 !$omp end taskloop499 500 !ERROR: At most one IF clause can appear on the TASKLOOP directive501 !$omp taskloop if(.true.) if(taskloop: .false.)502 do i = 1, 10503 end do504 !$omp end taskloop505 506 ! ----------------------------------------------------------------------------507 ! TASKLOOP SIMD508 ! ----------------------------------------------------------------------------509 !$omp taskloop simd if(.true.)510 do i = 1, 10511 end do512 !$omp end taskloop simd513 514 !$omp taskloop simd if(taskloop: .true.) if(simd: .false.)515 do i = 1, 10516 end do517 !$omp end taskloop simd518 519 !ERROR: TARGET is not a constituent of the TASKLOOP SIMD directive520 !$omp taskloop simd if(target: .true.)521 do i = 1, 10522 end do523 !$omp end taskloop simd524 525 ! ----------------------------------------------------------------------------526 ! TEAMS527 ! ----------------------------------------------------------------------------528 !$omp teams if(.true.)529 !$omp end teams530 531 !$omp teams if(teams: .true.)532 !$omp end teams533 534 !ERROR: TARGET is not a constituent of the TEAMS directive535 !$omp teams if(target: .true.)536 !$omp end teams537 538 !ERROR: At most one IF clause can appear on the TEAMS directive539 !$omp teams if(.true.) if(teams: .false.)540 !$omp end teams541 542 ! ----------------------------------------------------------------------------543 ! TEAMS DISTRIBUTE544 ! ----------------------------------------------------------------------------545 !$omp teams distribute if(.true.)546 do i = 1, 10547 end do548 !$omp end teams distribute549 550 !$omp teams distribute if(teams: .true.)551 do i = 1, 10552 end do553 !$omp end teams distribute554 555 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE directive556 !$omp teams distribute if(target: .true.)557 do i = 1, 10558 end do559 !$omp end teams distribute560 561 !ERROR: At most one IF clause can appear on the TEAMS DISTRIBUTE directive562 !$omp teams distribute if(.true.) if(teams: .true.)563 do i = 1, 10564 end do565 !$omp end teams distribute566 567 ! ----------------------------------------------------------------------------568 ! TEAMS DISTRIBUTE PARALLEL DO569 ! ----------------------------------------------------------------------------570 !$omp teams distribute parallel do if(.true.)571 do i = 1, 10572 end do573 !$omp end teams distribute parallel do574 575 !$omp teams distribute parallel do if(teams: .true.) if(parallel: .false.)576 do i = 1, 10577 end do578 !$omp end teams distribute parallel do579 580 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO directive581 !$omp teams distribute parallel do if(target: .true.)582 do i = 1, 10583 end do584 !$omp end teams distribute parallel do585 586 ! ----------------------------------------------------------------------------587 ! TEAMS DISTRIBUTE PARALLEL DO SIMD588 ! ----------------------------------------------------------------------------589 !$omp teams distribute parallel do simd if(.true.)590 do i = 1, 10591 end do592 !$omp end teams distribute parallel do simd593 594 !$omp teams distribute parallel do simd &595 !$omp& if(teams: .true.) if(parallel: .true.) if(simd: .true.)596 do i = 1, 10597 end do598 !$omp end teams distribute parallel do simd599 600 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO SIMD directive601 !$omp teams distribute parallel do simd if(target: .true.)602 do i = 1, 10603 end do604 !$omp end teams distribute parallel do simd605 606 ! ----------------------------------------------------------------------------607 ! TEAMS DISTRIBUTE SIMD608 ! ----------------------------------------------------------------------------609 !$omp teams distribute simd if(.true.)610 do i = 1, 10611 end do612 !$omp end teams distribute simd613 614 !$omp teams distribute simd if(teams: .true.) if(simd: .true.)615 do i = 1, 10616 end do617 !$omp end teams distribute simd618 619 !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE SIMD directive620 !$omp teams distribute simd if(target: .true.)621 do i = 1, 10622 end do623 !$omp end teams distribute simd624end program main625