1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s 2 3 void bar(); 4 5 template <class T> 6 void foo() { 7 T a = T(); 8 // PARALLEL DIRECTIVE 9 #pragma omp parallel 10 #pragma omp for 11 for (int i = 0; i < 10; ++i) 12 ; 13 #pragma omp parallel 14 #pragma omp simd 15 for (int i = 0; i < 10; ++i) 16 ; 17 #pragma omp parallel 18 #pragma omp for simd 19 for (int i = 0; i < 10; ++i) 20 ; 21 #pragma omp parallel 22 #pragma omp sections 23 { 24 bar(); 25 } 26 #pragma omp parallel 27 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel region}} 28 { 29 bar(); 30 } 31 #pragma omp parallel 32 #pragma omp single 33 bar(); 34 35 #pragma omp parallel 36 #pragma omp master 37 { 38 bar(); 39 } 40 #pragma omp parallel 41 #pragma omp critical 42 { 43 bar(); 44 } 45 #pragma omp parallel 46 #pragma omp parallel for 47 for (int i = 0; i < 10; ++i) 48 ; 49 #pragma omp parallel 50 #pragma omp parallel for simd 51 for (int i = 0; i < 10; ++i) 52 ; 53 #pragma omp parallel 54 #pragma omp parallel sections 55 { 56 bar(); 57 } 58 #pragma omp parallel 59 #pragma omp task 60 { 61 bar(); 62 } 63 #pragma omp parallel 64 { 65 #pragma omp taskyield 66 bar(); 67 } 68 #pragma omp parallel 69 { 70 #pragma omp barrier 71 bar(); 72 } 73 #pragma omp parallel 74 { 75 #pragma omp taskwait 76 bar(); 77 } 78 #pragma omp parallel 79 { 80 #pragma omp flush 81 bar(); 82 } 83 #pragma omp parallel 84 { 85 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 86 bar(); 87 } 88 #pragma omp parallel 89 { 90 #pragma omp atomic 91 ++a; 92 } 93 #pragma omp parallel 94 { 95 #pragma omp target 96 ++a; 97 } 98 #pragma omp parallel 99 { 100 #pragma omp target parallel 101 ++a; 102 } 103 #pragma omp parallel 104 { 105 #pragma omp target parallel for 106 for (int i = 0; i < 10; ++i) 107 ; 108 } 109 #pragma omp parallel 110 { 111 #pragma omp target enter data map(to: a) 112 ++a; 113 } 114 #pragma omp parallel 115 { 116 #pragma omp target exit data map(from: a) 117 ++a; 118 } 119 #pragma omp parallel 120 { 121 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 122 ++a; 123 } 124 #pragma omp parallel 125 { 126 #pragma omp taskloop 127 for (int i = 0; i < 10; ++i) 128 ++a; 129 } 130 #pragma omp parallel 131 { 132 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 133 for (int i = 0; i < 10; ++i) 134 ; 135 } 136 #pragma omp parallel 137 { 138 #pragma omp target update to(a) 139 } 140 #pragma omp parallel 141 { 142 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 143 for (int i = 0; i < 10; ++i) 144 ; 145 } 146 #pragma omp parallel 147 { 148 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 149 for (int i = 0; i < 10; ++i) 150 ; 151 } 152 #pragma omp parallel 153 { 154 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 155 for (int i = 0; i < 10; ++i) 156 ; 157 } 158 159 // SIMD DIRECTIVE 160 #pragma omp simd 161 for (int i = 0; i < 10; ++i) { 162 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 163 for (int i = 0; i < 10; ++i) 164 ; 165 } 166 #pragma omp simd 167 for (int i = 0; i < 10; ++i) { 168 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 169 for (int i = 0; i < 10; ++i) 170 ; 171 } 172 #pragma omp simd 173 for (int i = 0; i < 10; ++i) { 174 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 175 for (int i = 0; i < 10; ++i) 176 ; 177 } 178 #pragma omp simd 179 for (int i = 0; i < 10; ++i) { 180 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 181 for (int i = 0; i < 10; ++i) 182 ; 183 } 184 #pragma omp simd 185 for (int i = 0; i < 10; ++i) { 186 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 187 { 188 bar(); 189 } 190 } 191 #pragma omp simd 192 for (int i = 0; i < 10; ++i) { 193 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 194 { 195 bar(); 196 } 197 } 198 #pragma omp simd 199 for (int i = 0; i < 10; ++i) { 200 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 201 { 202 bar(); 203 } 204 } 205 #pragma omp simd 206 for (int i = 0; i < 10; ++i) { 207 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 208 { 209 bar(); 210 } 211 } 212 #pragma omp simd 213 for (int i = 0; i < 10; ++i) { 214 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 215 { 216 bar(); 217 } 218 } 219 #pragma omp simd 220 for (int i = 0; i < 10; ++i) { 221 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 222 for (int i = 0; i < 10; ++i) 223 ; 224 } 225 #pragma omp simd 226 for (int i = 0; i < 10; ++i) { 227 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 228 for (int i = 0; i < 10; ++i) 229 ; 230 } 231 #pragma omp simd 232 for (int i = 0; i < 10; ++i) { 233 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 234 { 235 bar(); 236 } 237 } 238 #pragma omp simd 239 for (int i = 0; i < 10; ++i) { 240 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 241 { 242 bar(); 243 } 244 } 245 #pragma omp simd 246 for (int i = 0; i < 10; ++i) { 247 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 248 bar(); 249 } 250 #pragma omp simd 251 for (int i = 0; i < 10; ++i) { 252 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 253 bar(); 254 } 255 #pragma omp simd 256 for (int i = 0; i < 10; ++i) { 257 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 258 bar(); 259 } 260 #pragma omp simd 261 for (int i = 0; i < 10; ++i) { 262 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 263 bar(); 264 } 265 #pragma omp simd 266 for (int i = 0; i < 10; ++i) { 267 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 268 bar(); 269 } 270 #pragma omp simd 271 for (int i = 0; i < 10; ++i) { 272 #pragma omp ordered simd // OK 273 bar(); 274 } 275 #pragma omp simd 276 for (int i = 0; i < 10; ++i) { 277 #pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}} 278 bar(); 279 } 280 #pragma omp simd 281 for (int i = 0; i < 10; ++i) { 282 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 283 ++a; 284 } 285 #pragma omp simd 286 for (int i = 0; i < 10; ++i) { 287 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 288 ++a; 289 } 290 #pragma omp simd 291 for (int i = 0; i < 10; ++i) { 292 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 293 ++a; 294 } 295 #pragma omp simd 296 for (int i = 0; i < 10; ++i) { 297 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 298 for (int i = 0; i < 10; ++i) 299 ; 300 } 301 #pragma omp simd 302 for (int i = 0; i < 10; ++i) { 303 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 304 ++a; 305 } 306 #pragma omp simd 307 for (int i = 0; i < 10; ++i) { 308 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 309 ++a; 310 } 311 #pragma omp simd 312 for (int i = 0; i < 10; ++i) { 313 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 314 ++a; 315 } 316 #pragma omp simd 317 for (int i = 0; i < 10; ++i) { 318 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}} 319 for (int i = 0; i < 10; ++i) 320 ++a; 321 } 322 #pragma omp simd 323 for (int i = 0; i < 10; ++i) { 324 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 325 for (int j = 0; j < 10; ++j) 326 ; 327 } 328 #pragma omp simd 329 for (int i = 0; i < 10; ++i) { 330 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 331 } 332 #pragma omp simd 333 for (int i = 0; i < 10; ++i) { 334 #pragma omp distribute parallel for// expected-error {{OpenMP constructs may not be nested inside a simd region}} 335 for (int j = 0; j < 10; ++j) 336 ; 337 } 338 #pragma omp simd 339 for (int i = 0; i < 10; ++i) { 340 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 341 for (int j = 0; j < 10; ++j) 342 ; 343 } 344 #pragma omp simd 345 for (int i = 0; i < 10; ++i) { 346 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 347 for (int j = 0; j < 10; ++j) 348 ; 349 } 350 351 // FOR DIRECTIVE 352 #pragma omp for 353 for (int i = 0; i < 10; ++i) { 354 #pragma omp for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 355 for (int i = 0; i < 10; ++i) 356 ; 357 } 358 #pragma omp for 359 for (int i = 0; i < 10; ++i) { 360 #pragma omp simd 361 for (int i = 0; i < 10; ++i) 362 ; 363 } 364 #pragma omp for 365 for (int i = 0; i < 10; ++i) { 366 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 367 for (int i = 0; i < 10; ++i) 368 ; 369 } 370 #pragma omp for 371 for (int i = 0; i < 10; ++i) { 372 #pragma omp parallel 373 for (int i = 0; i < 10; ++i) 374 ; 375 } 376 #pragma omp for 377 for (int i = 0; i < 10; ++i) { 378 #pragma omp sections // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 379 { 380 bar(); 381 } 382 } 383 #pragma omp for 384 for (int i = 0; i < 10; ++i) { 385 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a for region}} 386 { 387 bar(); 388 } 389 } 390 #pragma omp for 391 for (int i = 0; i < 10; ++i) { 392 #pragma omp single // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 393 { 394 bar(); 395 } 396 } 397 398 #pragma omp for 399 for (int i = 0; i < 10; ++i) { 400 #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}} 401 { 402 bar(); 403 } 404 } 405 #pragma omp for 406 for (int i = 0; i < 10; ++i) { 407 #pragma omp critical 408 { 409 bar(); 410 } 411 } 412 #pragma omp for 413 for (int i = 0; i < 10; ++i) { 414 #pragma omp parallel 415 { 416 #pragma omp single // OK 417 { 418 bar(); 419 } 420 #pragma omp for // OK 421 for (int i = 0; i < 10; ++i) 422 ; 423 #pragma omp sections // OK 424 { 425 bar(); 426 } 427 } 428 } 429 #pragma omp for 430 for (int i = 0; i < 10; ++i) { 431 #pragma omp parallel for 432 for (int i = 0; i < 10; ++i) 433 ; 434 } 435 #pragma omp for 436 for (int i = 0; i < 10; ++i) { 437 #pragma omp parallel for simd 438 for (int i = 0; i < 10; ++i) 439 ; 440 } 441 #pragma omp for 442 for (int i = 0; i < 10; ++i) { 443 #pragma omp parallel sections 444 { 445 bar(); 446 } 447 } 448 #pragma omp for 449 for (int i = 0; i < 10; ++i) { 450 #pragma omp task 451 { 452 bar(); 453 } 454 } 455 #pragma omp for 456 for (int i = 0; i < 10; ++i) { 457 #pragma omp taskyield 458 bar(); 459 } 460 #pragma omp for 461 for (int i = 0; i < 10; ++i) { 462 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}} 463 bar(); 464 } 465 #pragma omp for 466 for (int i = 0; i < 10; ++i) { 467 #pragma omp taskwait 468 bar(); 469 } 470 #pragma omp for 471 for (int i = 0; i < 10; ++i) { 472 #pragma omp flush 473 bar(); 474 } 475 #pragma omp for 476 for (int i = 0; i < 10; ++i) { 477 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 478 bar(); 479 } 480 #pragma omp for ordered 481 for (int i = 0; i < 10; ++i) { 482 #pragma omp ordered // OK 483 bar(); 484 } 485 #pragma omp for 486 for (int i = 0; i < 10; ++i) { 487 #pragma omp atomic 488 ++a; 489 } 490 #pragma omp for 491 for (int i = 0; i < 10; ++i) { 492 #pragma omp target 493 ++a; 494 } 495 #pragma omp for 496 for (int i = 0; i < 10; ++i) { 497 #pragma omp target parallel 498 ++a; 499 } 500 #pragma omp for 501 for (int i = 0; i < 10; ++i) { 502 #pragma omp target parallel for 503 for (int i = 0; i < 10; ++i) 504 ; 505 } 506 #pragma omp for 507 for (int i = 0; i < 10; ++i) { 508 #pragma omp target enter data map(to: a) 509 ++a; 510 } 511 #pragma omp for 512 for (int i = 0; i < 10; ++i) { 513 #pragma omp target exit data map(from: a) 514 ++a; 515 } 516 #pragma omp for 517 for (int i = 0; i < 10; ++i) { 518 #pragma omp teams // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 519 ++a; 520 } 521 #pragma omp for 522 for (int i = 0; i < 10; ++i) { 523 #pragma omp taskloop 524 for (int i = 0; i < 10; ++i) 525 ++a; 526 } 527 #pragma omp for 528 for (int i = 0; i < 10; ++i) { 529 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 530 for (int j = 0; j < 10; ++j) 531 ; 532 } 533 #pragma omp for 534 for (int i = 0; i < 10; ++i) { 535 #pragma omp target update to(a) 536 } 537 #pragma omp for 538 for (int i = 0; i < 10; ++i) { 539 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 540 for (int j = 0; j < 10; ++j) 541 ; 542 } 543 #pragma omp for 544 for (int i = 0; i < 10; ++i) { 545 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 546 for (int j = 0; j < 10; ++j) 547 ; 548 } 549 #pragma omp for 550 for (int i = 0; i < 10; ++i) { 551 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 552 for (int j = 0; j < 10; ++j) 553 ; 554 } 555 556 // FOR SIMD DIRECTIVE 557 #pragma omp for simd 558 for (int i = 0; i < 10; ++i) { 559 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 560 for (int i = 0; i < 10; ++i) 561 ; 562 } 563 #pragma omp for simd 564 for (int i = 0; i < 10; ++i) { 565 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 566 for (int i = 0; i < 10; ++i) 567 ; 568 } 569 #pragma omp for simd 570 for (int i = 0; i < 10; ++i) { 571 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 572 for (int i = 0; i < 10; ++i) 573 ; 574 } 575 #pragma omp for simd 576 for (int i = 0; i < 10; ++i) { 577 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 578 for (int i = 0; i < 10; ++i) 579 ; 580 } 581 #pragma omp for simd 582 for (int i = 0; i < 10; ++i) { 583 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 584 { 585 bar(); 586 } 587 } 588 #pragma omp for simd 589 for (int i = 0; i < 10; ++i) { 590 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 591 { 592 bar(); 593 } 594 } 595 #pragma omp for simd 596 for (int i = 0; i < 10; ++i) { 597 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 598 { 599 bar(); 600 } 601 } 602 #pragma omp for simd 603 for (int i = 0; i < 10; ++i) { 604 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 605 { 606 bar(); 607 } 608 } 609 #pragma omp for simd 610 for (int i = 0; i < 10; ++i) { 611 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 612 { 613 bar(); 614 } 615 } 616 #pragma omp for simd 617 for (int i = 0; i < 10; ++i) { 618 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 619 for (int i = 0; i < 10; ++i) 620 ; 621 } 622 #pragma omp for simd 623 for (int i = 0; i < 10; ++i) { 624 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 625 for (int i = 0; i < 10; ++i) 626 ; 627 } 628 #pragma omp for simd 629 for (int i = 0; i < 10; ++i) { 630 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 631 { 632 bar(); 633 } 634 } 635 #pragma omp for simd 636 for (int i = 0; i < 10; ++i) { 637 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 638 { 639 bar(); 640 } 641 } 642 #pragma omp for simd 643 for (int i = 0; i < 10; ++i) { 644 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 645 bar(); 646 } 647 #pragma omp for simd 648 for (int i = 0; i < 10; ++i) { 649 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 650 bar(); 651 } 652 #pragma omp for simd 653 for (int i = 0; i < 10; ++i) { 654 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 655 bar(); 656 } 657 #pragma omp for simd 658 for (int i = 0; i < 10; ++i) { 659 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 660 bar(); 661 } 662 #pragma omp for simd 663 for (int i = 0; i < 10; ++i) { 664 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 665 bar(); 666 } 667 #pragma omp for simd 668 for (int i = 0; i < 10; ++i) { 669 #pragma omp ordered simd // OK 670 bar(); 671 } 672 #pragma omp for simd 673 for (int i = 0; i < 10; ++i) { 674 #pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}} 675 bar(); 676 } 677 #pragma omp for simd 678 for (int i = 0; i < 10; ++i) { 679 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 680 ++a; 681 } 682 #pragma omp for simd 683 for (int i = 0; i < 10; ++i) { 684 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 685 ++a; 686 } 687 #pragma omp for simd 688 for (int i = 0; i < 10; ++i) { 689 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 690 ++a; 691 } 692 #pragma omp for simd 693 for (int i = 0; i < 10; ++i) { 694 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 695 for (int i = 0; i < 10; ++i) 696 ; 697 } 698 #pragma omp for simd 699 for (int i = 0; i < 10; ++i) { 700 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 701 ++a; 702 } 703 #pragma omp for simd 704 for (int i = 0; i < 10; ++i) { 705 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 706 ++a; 707 } 708 #pragma omp for simd 709 for (int i = 0; i < 10; ++i) { 710 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 711 ++a; 712 } 713 #pragma omp for simd 714 for (int i = 0; i < 10; ++i) { 715 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}} 716 for (int i = 0; i < 10; ++i) 717 ++a; 718 } 719 #pragma omp for simd 720 for (int i = 0; i < 10; ++i) { 721 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 722 for (int j = 0; j < 10; ++j) 723 ; 724 } 725 #pragma omp for simd 726 for (int i = 0; i < 10; ++i) { 727 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 728 bar(); 729 } 730 #pragma omp for simd 731 for (int i = 0; i < 10; ++i) { 732 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 733 for (int j = 0; j < 10; ++j) 734 ; 735 } 736 #pragma omp for simd 737 for (int i = 0; i < 10; ++i) { 738 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 739 for (int j = 0; j < 10; ++j) 740 ; 741 } 742 #pragma omp for simd 743 for (int i = 0; i < 10; ++i) { 744 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 745 for (int j = 0; j < 10; ++j) 746 ; 747 } 748 749 // SECTIONS DIRECTIVE 750 #pragma omp sections 751 { 752 #pragma omp for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 753 for (int i = 0; i < 10; ++i) 754 ; 755 } 756 #pragma omp sections 757 { 758 #pragma omp simd 759 for (int i = 0; i < 10; ++i) 760 ; 761 } 762 #pragma omp sections 763 { 764 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 765 for (int i = 0; i < 10; ++i) 766 ; 767 } 768 #pragma omp sections 769 { 770 #pragma omp parallel 771 for (int i = 0; i < 10; ++i) 772 ; 773 } 774 #pragma omp sections 775 { 776 #pragma omp sections // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 777 { 778 bar(); 779 } 780 } 781 #pragma omp sections 782 { 783 #pragma omp section 784 { 785 bar(); 786 } 787 } 788 #pragma omp sections 789 { 790 #pragma omp parallel 791 { 792 #pragma omp single // OK 793 { 794 bar(); 795 } 796 #pragma omp for // OK 797 for (int i = 0; i < 10; ++i) 798 ; 799 #pragma omp sections // OK 800 { 801 bar(); 802 } 803 } 804 } 805 #pragma omp sections 806 { 807 #pragma omp parallel 808 { 809 #pragma omp master // OK 810 { 811 bar(); 812 } 813 #pragma omp for // OK 814 for (int i = 0; i < 10; ++i) 815 ; 816 #pragma omp master // OK 817 { 818 bar(); 819 } 820 } 821 #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}} 822 bar(); 823 } 824 #pragma omp sections 825 { 826 #pragma omp parallel 827 { 828 #pragma omp critical(A) // OK 829 { 830 bar(); 831 } 832 #pragma omp for // OK 833 for (int i = 0; i < 10; ++i) 834 ; 835 #pragma omp critical // OK 836 { 837 bar(); 838 } 839 } 840 #pragma omp critical(A) // expected-error {{statement in 'omp sections' directive must be enclosed into a section region}} 841 bar(); 842 } 843 #pragma omp sections 844 { 845 #pragma omp parallel for 846 for (int i = 0; i < 10; ++i) 847 ; 848 } 849 #pragma omp sections 850 { 851 #pragma omp parallel for simd 852 for (int i = 0; i < 10; ++i) 853 ; 854 } 855 #pragma omp sections 856 { 857 #pragma omp parallel sections 858 { 859 bar(); 860 } 861 } 862 #pragma omp sections 863 { 864 #pragma omp task 865 { 866 bar(); 867 } 868 } 869 #pragma omp sections 870 { 871 #pragma omp taskyield 872 } 873 #pragma omp sections 874 { 875 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}} 876 } 877 #pragma omp sections 878 { 879 #pragma omp taskwait 880 } 881 #pragma omp sections 882 { 883 #pragma omp flush 884 } 885 #pragma omp sections 886 { 887 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 888 bar(); 889 } 890 #pragma omp sections 891 { 892 #pragma omp atomic 893 ++a; 894 } 895 #pragma omp sections 896 { 897 #pragma omp target 898 ++a; 899 } 900 #pragma omp sections 901 { 902 #pragma omp target parallel 903 ++a; 904 } 905 #pragma omp sections 906 { 907 #pragma omp target parallel for 908 for (int i = 0; i < 10; ++i) 909 ; 910 } 911 #pragma omp sections 912 { 913 #pragma omp target enter data map(to: a) 914 } 915 #pragma omp sections 916 { 917 #pragma omp target exit data map(from: a) 918 } 919 #pragma omp sections 920 { 921 #pragma omp teams // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 922 ++a; 923 } 924 #pragma omp sections 925 { 926 #pragma omp taskloop 927 for (int i = 0; i < 10; ++i) 928 ++a; 929 } 930 #pragma omp sections 931 { 932 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 933 for (int i = 0; i < 10; ++i) 934 ; 935 } 936 #pragma omp sections 937 { 938 #pragma omp target update to(a) 939 } 940 #pragma omp sections 941 { 942 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 943 for (int i = 0; i < 10; ++i) 944 ; 945 } 946 #pragma omp sections 947 { 948 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 949 for (int i = 0; i < 10; ++i) 950 ; 951 } 952 #pragma omp sections 953 { 954 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 955 for (int i = 0; i < 10; ++i) 956 ; 957 } 958 959 // SECTION DIRECTIVE 960 #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}} 961 { 962 bar(); 963 } 964 #pragma omp sections 965 { 966 #pragma omp section 967 { 968 #pragma omp for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 969 for (int i = 0; i < 10; ++i) 970 ; 971 } 972 } 973 #pragma omp sections 974 { 975 #pragma omp section 976 { 977 #pragma omp simd 978 for (int i = 0; i < 10; ++i) 979 ; 980 } 981 } 982 #pragma omp sections 983 { 984 #pragma omp section 985 { 986 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 987 for (int i = 0; i < 10; ++i) 988 ; 989 } 990 } 991 #pragma omp sections 992 { 993 #pragma omp section 994 { 995 #pragma omp parallel 996 for (int i = 0; i < 10; ++i) 997 ; 998 } 999 } 1000 #pragma omp sections 1001 { 1002 #pragma omp section 1003 { 1004 #pragma omp sections // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 1005 { 1006 bar(); 1007 } 1008 } 1009 } 1010 #pragma omp sections 1011 { 1012 #pragma omp section 1013 { 1014 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a section region}} 1015 { 1016 bar(); 1017 } 1018 } 1019 } 1020 #pragma omp sections 1021 { 1022 #pragma omp section 1023 { 1024 #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 1025 bar(); 1026 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}} 1027 bar(); 1028 #pragma omp critical 1029 bar(); 1030 } 1031 } 1032 #pragma omp sections 1033 { 1034 #pragma omp section 1035 { 1036 #pragma omp parallel 1037 { 1038 #pragma omp single // OK 1039 { 1040 bar(); 1041 } 1042 #pragma omp for // OK 1043 for (int i = 0; i < 10; ++i) 1044 ; 1045 #pragma omp for simd // OK 1046 for (int i = 0; i < 10; ++i) 1047 ; 1048 #pragma omp sections // OK 1049 { 1050 bar(); 1051 } 1052 } 1053 } 1054 } 1055 #pragma omp sections 1056 { 1057 #pragma omp section 1058 { 1059 #pragma omp parallel for 1060 for (int i = 0; i < 10; ++i) 1061 ; 1062 } 1063 } 1064 #pragma omp sections 1065 { 1066 #pragma omp section 1067 { 1068 #pragma omp parallel for simd 1069 for (int i = 0; i < 10; ++i) 1070 ; 1071 } 1072 } 1073 #pragma omp sections 1074 { 1075 #pragma omp section 1076 { 1077 #pragma omp parallel sections 1078 { 1079 bar(); 1080 } 1081 } 1082 } 1083 #pragma omp sections 1084 { 1085 #pragma omp section 1086 { 1087 #pragma omp task 1088 { 1089 bar(); 1090 } 1091 } 1092 } 1093 #pragma omp sections 1094 { 1095 #pragma omp section 1096 { 1097 #pragma omp taskyield 1098 bar(); 1099 } 1100 } 1101 #pragma omp sections 1102 { 1103 #pragma omp section 1104 { 1105 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'section' region}} 1106 bar(); 1107 } 1108 } 1109 #pragma omp sections 1110 { 1111 #pragma omp section 1112 { 1113 #pragma omp taskwait 1114 bar(); 1115 } 1116 } 1117 #pragma omp sections 1118 { 1119 #pragma omp section 1120 { 1121 #pragma omp flush 1122 bar(); 1123 } 1124 } 1125 #pragma omp sections 1126 { 1127 #pragma omp section 1128 { 1129 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 1130 bar(); 1131 } 1132 } 1133 #pragma omp sections 1134 { 1135 #pragma omp section 1136 #pragma omp atomic 1137 ++a; 1138 } 1139 #pragma omp sections 1140 { 1141 #pragma omp section 1142 #pragma omp target 1143 ++a; 1144 } 1145 #pragma omp sections 1146 { 1147 #pragma omp section 1148 #pragma omp target parallel 1149 ++a; 1150 } 1151 #pragma omp sections 1152 { 1153 #pragma omp section 1154 { 1155 #pragma omp target parallel for 1156 for (int i = 0; i < 10; ++i) 1157 ; 1158 } 1159 } 1160 #pragma omp sections 1161 { 1162 #pragma omp section 1163 { 1164 #pragma omp target enter data map(to: a) 1165 ++a; 1166 } 1167 } 1168 #pragma omp sections 1169 { 1170 #pragma omp section 1171 { 1172 #pragma omp target exit data map(from: a) 1173 ++a; 1174 } 1175 } 1176 #pragma omp sections 1177 { 1178 #pragma omp section 1179 #pragma omp teams // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 1180 ++a; 1181 } 1182 #pragma omp sections 1183 { 1184 #pragma omp section 1185 #pragma omp taskloop 1186 for (int i = 0; i < 10; ++i) 1187 ++a; 1188 } 1189 #pragma omp sections 1190 { 1191 #pragma omp section 1192 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 1193 for (int i = 0; i < 10; ++i) 1194 ; 1195 } 1196 #pragma omp sections 1197 { 1198 #pragma omp section 1199 { 1200 bar(); 1201 #pragma omp target update to(a) 1202 } 1203 } 1204 #pragma omp sections 1205 { 1206 #pragma omp section 1207 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 1208 for (int i = 0; i < 10; ++i) 1209 ; 1210 } 1211 #pragma omp sections 1212 { 1213 #pragma omp section 1214 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 1215 for (int i = 0; i < 10; ++i) 1216 ; 1217 } 1218 #pragma omp sections 1219 { 1220 #pragma omp section 1221 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 1222 for (int i = 0; i < 10; ++i) 1223 ; 1224 } 1225 1226 // SINGLE DIRECTIVE 1227 #pragma omp single 1228 { 1229 #pragma omp for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 1230 for (int i = 0; i < 10; ++i) 1231 ; 1232 } 1233 #pragma omp single 1234 { 1235 #pragma omp simd 1236 for (int i = 0; i < 10; ++i) 1237 ; 1238 } 1239 #pragma omp single 1240 { 1241 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 1242 for (int i = 0; i < 10; ++i) 1243 ; 1244 } 1245 #pragma omp single 1246 { 1247 #pragma omp parallel 1248 for (int i = 0; i < 10; ++i) 1249 ; 1250 } 1251 #pragma omp single 1252 { 1253 #pragma omp single // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 1254 { 1255 bar(); 1256 } 1257 } 1258 #pragma omp single 1259 { 1260 #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}} 1261 { 1262 bar(); 1263 } 1264 } 1265 #pragma omp single 1266 { 1267 #pragma omp critical 1268 { 1269 bar(); 1270 } 1271 } 1272 #pragma omp single 1273 { 1274 #pragma omp sections // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 1275 { 1276 bar(); 1277 } 1278 } 1279 #pragma omp single 1280 { 1281 #pragma omp parallel 1282 { 1283 #pragma omp single // OK 1284 { 1285 bar(); 1286 } 1287 #pragma omp for // OK 1288 for (int i = 0; i < 10; ++i) 1289 ; 1290 #pragma omp for simd // OK 1291 for (int i = 0; i < 10; ++i) 1292 ; 1293 #pragma omp sections // OK 1294 { 1295 bar(); 1296 } 1297 } 1298 } 1299 #pragma omp single 1300 { 1301 #pragma omp parallel for 1302 for (int i = 0; i < 10; ++i) 1303 ; 1304 } 1305 #pragma omp single 1306 { 1307 #pragma omp parallel for simd 1308 for (int i = 0; i < 10; ++i) 1309 ; 1310 } 1311 #pragma omp single 1312 { 1313 #pragma omp parallel sections 1314 { 1315 bar(); 1316 } 1317 } 1318 #pragma omp single 1319 { 1320 #pragma omp task 1321 { 1322 bar(); 1323 } 1324 } 1325 #pragma omp single 1326 { 1327 #pragma omp taskyield 1328 bar(); 1329 } 1330 #pragma omp single 1331 { 1332 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}} 1333 bar(); 1334 } 1335 #pragma omp single 1336 { 1337 #pragma omp taskwait 1338 bar(); 1339 } 1340 #pragma omp single 1341 { 1342 #pragma omp flush 1343 bar(); 1344 } 1345 #pragma omp single 1346 { 1347 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 1348 bar(); 1349 } 1350 #pragma omp single 1351 { 1352 #pragma omp atomic 1353 ++a; 1354 } 1355 #pragma omp single 1356 { 1357 #pragma omp target 1358 ++a; 1359 } 1360 #pragma omp single 1361 { 1362 #pragma omp target parallel 1363 ++a; 1364 } 1365 #pragma omp single 1366 { 1367 #pragma omp target parallel for 1368 for (int i = 0; i < 10; ++i) 1369 ; 1370 } 1371 #pragma omp single 1372 { 1373 #pragma omp target enter data map(to: a) 1374 ++a; 1375 } 1376 #pragma omp single 1377 { 1378 #pragma omp target exit data map(from: a) 1379 ++a; 1380 } 1381 #pragma omp single 1382 { 1383 #pragma omp teams // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 1384 ++a; 1385 } 1386 #pragma omp single 1387 { 1388 #pragma omp taskloop 1389 for (int i = 0; i < 10; ++i) 1390 ++a; 1391 } 1392 #pragma omp single 1393 { 1394 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 1395 for (int i = 0; i < 10; ++i) 1396 ; 1397 } 1398 #pragma omp single 1399 { 1400 #pragma omp target update to(a) 1401 bar(); 1402 } 1403 #pragma omp single 1404 { 1405 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 1406 for (int i = 0; i < 10; ++i) 1407 ; 1408 } 1409 #pragma omp single 1410 { 1411 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 1412 for (int i = 0; i < 10; ++i) 1413 ; 1414 } 1415 #pragma omp single 1416 { 1417 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 1418 for (int i = 0; i < 10; ++i) 1419 ; 1420 } 1421 1422 // MASTER DIRECTIVE 1423 #pragma omp master 1424 { 1425 #pragma omp for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 1426 for (int i = 0; i < 10; ++i) 1427 ; 1428 } 1429 #pragma omp master 1430 { 1431 #pragma omp simd 1432 for (int i = 0; i < 10; ++i) 1433 ; 1434 } 1435 #pragma omp master 1436 { 1437 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 1438 for (int i = 0; i < 10; ++i) 1439 ; 1440 } 1441 #pragma omp master 1442 { 1443 #pragma omp parallel 1444 for (int i = 0; i < 10; ++i) 1445 ; 1446 } 1447 #pragma omp master 1448 { 1449 #pragma omp single // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 1450 { 1451 bar(); 1452 } 1453 } 1454 #pragma omp master 1455 { 1456 #pragma omp master // OK, though second 'master' is redundant 1457 { 1458 bar(); 1459 } 1460 } 1461 #pragma omp master 1462 { 1463 #pragma omp critical 1464 { 1465 bar(); 1466 } 1467 } 1468 #pragma omp master 1469 { 1470 #pragma omp sections // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 1471 { 1472 bar(); 1473 } 1474 } 1475 #pragma omp master 1476 { 1477 #pragma omp parallel 1478 { 1479 #pragma omp master // OK 1480 { 1481 bar(); 1482 } 1483 #pragma omp for // OK 1484 for (int i = 0; i < 10; ++i) 1485 ; 1486 #pragma omp for simd // OK 1487 for (int i = 0; i < 10; ++i) 1488 ; 1489 #pragma omp sections // OK 1490 { 1491 bar(); 1492 } 1493 } 1494 } 1495 #pragma omp master 1496 { 1497 #pragma omp parallel for 1498 for (int i = 0; i < 10; ++i) 1499 ; 1500 } 1501 #pragma omp master 1502 { 1503 #pragma omp parallel for simd 1504 for (int i = 0; i < 10; ++i) 1505 ; 1506 } 1507 #pragma omp master 1508 { 1509 #pragma omp parallel sections 1510 { 1511 bar(); 1512 } 1513 } 1514 #pragma omp master 1515 { 1516 #pragma omp task 1517 { 1518 bar(); 1519 } 1520 } 1521 #pragma omp master 1522 { 1523 #pragma omp taskyield 1524 bar(); 1525 } 1526 #pragma omp master 1527 { 1528 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}} 1529 bar(); 1530 } 1531 #pragma omp master 1532 { 1533 #pragma omp taskwait 1534 bar(); 1535 } 1536 #pragma omp master 1537 { 1538 #pragma omp flush 1539 bar(); 1540 } 1541 #pragma omp master 1542 { 1543 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 1544 bar(); 1545 } 1546 #pragma omp master 1547 { 1548 #pragma omp atomic 1549 ++a; 1550 } 1551 #pragma omp master 1552 { 1553 #pragma omp target 1554 ++a; 1555 } 1556 #pragma omp master 1557 { 1558 #pragma omp target parallel 1559 ++a; 1560 } 1561 #pragma omp master 1562 { 1563 #pragma omp target parallel for 1564 for (int i = 0; i < 10; ++i) 1565 ; 1566 } 1567 #pragma omp master 1568 { 1569 #pragma omp target enter data map(to: a) 1570 ++a; 1571 } 1572 #pragma omp master 1573 { 1574 #pragma omp target exit data map(from: a) 1575 ++a; 1576 } 1577 #pragma omp master 1578 { 1579 #pragma omp teams // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 1580 ++a; 1581 } 1582 #pragma omp master 1583 { 1584 #pragma omp taskloop 1585 for (int i = 0; i < 10; ++i) 1586 ++a; 1587 } 1588 #pragma omp master 1589 { 1590 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 1591 for (int i = 0; i < 10; ++i) 1592 ; 1593 } 1594 #pragma omp master 1595 { 1596 #pragma omp target update to(a) 1597 bar(); 1598 } 1599 #pragma omp master 1600 { 1601 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 1602 for (int i = 0; i < 10; ++i) 1603 ; 1604 } 1605 #pragma omp master 1606 { 1607 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 1608 for (int i = 0; i < 10; ++i) 1609 ; 1610 } 1611 #pragma omp master 1612 { 1613 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 1614 for (int i = 0; i < 10; ++i) 1615 ; 1616 } 1617 1618 // CRITICAL DIRECTIVE 1619 #pragma omp critical 1620 { 1621 #pragma omp for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 1622 for (int i = 0; i < 10; ++i) 1623 ; 1624 } 1625 #pragma omp critical 1626 { 1627 #pragma omp simd 1628 for (int i = 0; i < 10; ++i) 1629 ; 1630 } 1631 #pragma omp critical 1632 { 1633 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 1634 for (int i = 0; i < 10; ++i) 1635 ; 1636 } 1637 #pragma omp critical 1638 { 1639 #pragma omp parallel 1640 for (int i = 0; i < 10; ++i) 1641 ; 1642 } 1643 #pragma omp critical 1644 { 1645 #pragma omp single // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 1646 { 1647 bar(); 1648 } 1649 } 1650 #pragma omp critical 1651 { 1652 #pragma omp master // OK, though second 'master' is redundant 1653 { 1654 bar(); 1655 } 1656 } 1657 #pragma omp critical 1658 { 1659 #pragma omp critical 1660 { 1661 bar(); 1662 } 1663 } 1664 #pragma omp critical 1665 { 1666 #pragma omp sections // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 1667 { 1668 bar(); 1669 } 1670 } 1671 #pragma omp critical 1672 { 1673 #pragma omp parallel 1674 { 1675 #pragma omp master // OK 1676 { 1677 bar(); 1678 } 1679 #pragma omp for // OK 1680 for (int i = 0; i < 10; ++i) 1681 ; 1682 #pragma omp for simd // OK 1683 for (int i = 0; i < 10; ++i) 1684 ; 1685 #pragma omp sections // OK 1686 { 1687 bar(); 1688 } 1689 } 1690 } 1691 #pragma omp critical 1692 { 1693 #pragma omp parallel for 1694 for (int i = 0; i < 10; ++i) 1695 ; 1696 } 1697 #pragma omp critical 1698 { 1699 #pragma omp parallel for simd 1700 for (int i = 0; i < 10; ++i) 1701 ; 1702 } 1703 #pragma omp critical 1704 { 1705 #pragma omp parallel sections 1706 { 1707 bar(); 1708 } 1709 } 1710 #pragma omp critical 1711 { 1712 #pragma omp task 1713 { 1714 bar(); 1715 } 1716 } 1717 #pragma omp critical 1718 { 1719 #pragma omp taskyield 1720 bar(); 1721 } 1722 #pragma omp critical 1723 { 1724 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'critical' region}} 1725 bar(); 1726 } 1727 #pragma omp critical 1728 { 1729 #pragma omp taskwait 1730 bar(); 1731 } 1732 #pragma omp critical(Tuzik) 1733 { 1734 #pragma omp critical(grelka) 1735 bar(); 1736 } 1737 #pragma omp critical(Belka) // expected-note {{previous 'critical' region starts here}} 1738 { 1739 #pragma omp critical(Belka) // expected-error {{cannot nest 'critical' regions having the same name 'Belka'}} 1740 { 1741 #pragma omp critical(Tuzik) 1742 { 1743 #pragma omp parallel 1744 #pragma omp critical(grelka) 1745 { 1746 bar(); 1747 } 1748 } 1749 } 1750 } 1751 #pragma omp critical 1752 { 1753 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 1754 bar(); 1755 } 1756 #pragma omp critical 1757 { 1758 #pragma omp atomic 1759 ++a; 1760 } 1761 #pragma omp critical 1762 { 1763 #pragma omp target 1764 ++a; 1765 } 1766 #pragma omp critical 1767 { 1768 #pragma omp target parallel 1769 ++a; 1770 } 1771 #pragma omp critical 1772 { 1773 #pragma omp target parallel for 1774 for (int i = 0; i < 10; ++i) 1775 ; 1776 } 1777 #pragma omp critical 1778 { 1779 #pragma omp target enter data map(to: a) 1780 ++a; 1781 } 1782 #pragma omp critical 1783 { 1784 #pragma omp target exit data map(from: a) 1785 ++a; 1786 } 1787 #pragma omp critical 1788 { 1789 #pragma omp teams // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 1790 ++a; 1791 } 1792 #pragma omp critical 1793 { 1794 #pragma omp taskloop 1795 for (int i = 0; i < 10; ++i) 1796 ++a; 1797 } 1798 #pragma omp critical 1799 { 1800 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 1801 for (int i = 0; i < 10; ++i) 1802 ; 1803 } 1804 #pragma omp critical 1805 { 1806 #pragma omp target update to(a) 1807 bar(); 1808 } 1809 #pragma omp critical 1810 { 1811 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 1812 for (int i = 0; i < 10; ++i) 1813 ; 1814 } 1815 #pragma omp critical 1816 { 1817 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 1818 for (int i = 0; i < 10; ++i) 1819 ; 1820 } 1821 #pragma omp critical 1822 { 1823 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 1824 for (int i = 0; i < 10; ++i) 1825 ; 1826 } 1827 1828 // PARALLEL FOR DIRECTIVE 1829 #pragma omp parallel for 1830 for (int i = 0; i < 10; ++i) { 1831 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 1832 for (int i = 0; i < 10; ++i) 1833 ; 1834 } 1835 #pragma omp parallel for 1836 for (int i = 0; i < 10; ++i) { 1837 #pragma omp simd 1838 for (int i = 0; i < 10; ++i) 1839 ; 1840 } 1841 #pragma omp parallel for 1842 for (int i = 0; i < 10; ++i) { 1843 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 1844 for (int i = 0; i < 10; ++i) 1845 ; 1846 } 1847 #pragma omp parallel for 1848 for (int i = 0; i < 10; ++i) { 1849 #pragma omp parallel 1850 for (int i = 0; i < 10; ++i) 1851 ; 1852 } 1853 #pragma omp parallel for 1854 for (int i = 0; i < 10; ++i) { 1855 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 1856 { 1857 bar(); 1858 } 1859 } 1860 #pragma omp parallel for 1861 for (int i = 0; i < 10; ++i) { 1862 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel for region}} 1863 { 1864 bar(); 1865 } 1866 } 1867 #pragma omp parallel for 1868 for (int i = 0; i < 10; ++i) { 1869 #pragma omp single // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 1870 { 1871 bar(); 1872 } 1873 } 1874 1875 #pragma omp parallel for 1876 for (int i = 0; i < 10; ++i) { 1877 #pragma omp master // expected-error {{region cannot be closely nested inside 'parallel for' region}} 1878 { 1879 bar(); 1880 } 1881 } 1882 1883 #pragma omp parallel for 1884 for (int i = 0; i < 10; ++i) { 1885 #pragma omp critical 1886 { 1887 bar(); 1888 } 1889 } 1890 1891 #pragma omp parallel for 1892 for (int i = 0; i < 10; ++i) { 1893 #pragma omp parallel 1894 { 1895 #pragma omp single // OK 1896 { 1897 bar(); 1898 } 1899 #pragma omp for // OK 1900 for (int i = 0; i < 10; ++i) 1901 ; 1902 #pragma omp for simd // OK 1903 for (int i = 0; i < 10; ++i) 1904 ; 1905 #pragma omp sections // OK 1906 { 1907 bar(); 1908 } 1909 } 1910 } 1911 #pragma omp parallel for 1912 for (int i = 0; i < 10; ++i) { 1913 #pragma omp parallel for 1914 for (int i = 0; i < 10; ++i) 1915 ; 1916 } 1917 #pragma omp parallel for 1918 for (int i = 0; i < 10; ++i) { 1919 #pragma omp parallel for simd 1920 for (int i = 0; i < 10; ++i) 1921 ; 1922 } 1923 #pragma omp parallel for 1924 for (int i = 0; i < 10; ++i) { 1925 #pragma omp parallel sections 1926 { 1927 bar(); 1928 } 1929 } 1930 #pragma omp parallel for 1931 for (int i = 0; i < 10; ++i) { 1932 #pragma omp task 1933 { 1934 bar(); 1935 } 1936 } 1937 #pragma omp parallel for 1938 for (int i = 0; i < 10; ++i) { 1939 #pragma omp taskyield 1940 bar(); 1941 } 1942 #pragma omp parallel for 1943 for (int i = 0; i < 10; ++i) { 1944 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}} 1945 bar(); 1946 } 1947 #pragma omp parallel for 1948 for (int i = 0; i < 10; ++i) { 1949 #pragma omp taskwait 1950 bar(); 1951 } 1952 #pragma omp parallel for 1953 for (int i = 0; i < 10; ++i) { 1954 #pragma omp flush 1955 bar(); 1956 } 1957 #pragma omp parallel for 1958 for (int i = 0; i < 10; ++i) { 1959 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 1960 bar(); 1961 } 1962 #pragma omp parallel for ordered 1963 for (int i = 0; i < 10; ++i) { 1964 #pragma omp ordered // OK 1965 bar(); 1966 } 1967 #pragma omp parallel for 1968 for (int i = 0; i < 10; ++i) { 1969 #pragma omp atomic 1970 ++a; 1971 } 1972 #pragma omp parallel for 1973 for (int i = 0; i < 10; ++i) { 1974 #pragma omp target 1975 ++a; 1976 } 1977 #pragma omp parallel for 1978 for (int i = 0; i < 10; ++i) { 1979 #pragma omp target parallel 1980 ++a; 1981 } 1982 #pragma omp parallel for 1983 for (int i = 0; i < 10; ++i) { 1984 #pragma omp target parallel for 1985 for (int i = 0; i < 10; ++i) 1986 ; 1987 } 1988 #pragma omp parallel for 1989 for (int i = 0; i < 10; ++i) { 1990 #pragma omp target enter data map(to: a) 1991 ++a; 1992 } 1993 #pragma omp parallel for 1994 for (int i = 0; i < 10; ++i) { 1995 #pragma omp target exit data map(from: a) 1996 ++a; 1997 } 1998 #pragma omp parallel for 1999 for (int i = 0; i < 10; ++i) { 2000 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 2001 ++a; 2002 } 2003 #pragma omp parallel for 2004 for (int i = 0; i < 10; ++i) { 2005 #pragma omp taskloop 2006 for (int i = 0; i < 10; ++i) 2007 ++a; 2008 } 2009 #pragma omp parallel for 2010 for (int i = 0; i < 10; ++i) { 2011 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 2012 for (int j = 0; j < 10; ++j) 2013 ; 2014 } 2015 #pragma omp parallel for 2016 for (int i = 0; i < 10; ++i) { 2017 #pragma omp target update to(a) 2018 } 2019 #pragma omp parallel for 2020 for (int i = 0; i < 10; ++i) { 2021 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 2022 for (int j = 0; j < 10; ++j) 2023 ; 2024 } 2025 #pragma omp parallel for 2026 for (int i = 0; i < 10; ++i) { 2027 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 2028 for (int j = 0; j < 10; ++j) 2029 ; 2030 } 2031 #pragma omp parallel for 2032 for (int i = 0; i < 10; ++i) { 2033 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 2034 for (int j = 0; j < 10; ++j) 2035 ; 2036 } 2037 2038 // PARALLEL FOR SIMD DIRECTIVE 2039 #pragma omp parallel for simd 2040 for (int i = 0; i < 10; ++i) { 2041 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2042 for (int i = 0; i < 10; ++i) 2043 ; 2044 } 2045 #pragma omp parallel for simd 2046 for (int i = 0; i < 10; ++i) { 2047 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 2048 for (int i = 0; i < 10; ++i) 2049 ; 2050 } 2051 #pragma omp parallel for simd 2052 for (int i = 0; i < 10; ++i) { 2053 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2054 for (int i = 0; i < 10; ++i) 2055 ; 2056 } 2057 #pragma omp parallel for simd 2058 for (int i = 0; i < 10; ++i) { 2059 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2060 for (int i = 0; i < 10; ++i) 2061 ; 2062 } 2063 #pragma omp parallel for simd 2064 for (int i = 0; i < 10; ++i) { 2065 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2066 { 2067 bar(); 2068 } 2069 } 2070 #pragma omp parallel for simd 2071 for (int i = 0; i < 10; ++i) { 2072 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2073 { 2074 bar(); 2075 } 2076 } 2077 #pragma omp parallel for simd 2078 for (int i = 0; i < 10; ++i) { 2079 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2080 { 2081 bar(); 2082 } 2083 } 2084 2085 #pragma omp parallel for simd 2086 for (int i = 0; i < 10; ++i) { 2087 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2088 { 2089 bar(); 2090 } 2091 } 2092 2093 #pragma omp parallel for simd 2094 for (int i = 0; i < 10; ++i) { 2095 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2096 { 2097 bar(); 2098 } 2099 } 2100 2101 #pragma omp parallel for simd 2102 for (int i = 0; i < 10; ++i) { 2103 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2104 { 2105 #pragma omp single 2106 { 2107 bar(); 2108 } 2109 #pragma omp for 2110 for (int i = 0; i < 10; ++i) 2111 ; 2112 #pragma omp for simd 2113 for (int i = 0; i < 10; ++i) 2114 ; 2115 #pragma omp sections 2116 { 2117 bar(); 2118 } 2119 } 2120 } 2121 #pragma omp parallel for simd 2122 for (int i = 0; i < 10; ++i) { 2123 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2124 for (int i = 0; i < 10; ++i) 2125 ; 2126 } 2127 #pragma omp parallel for simd 2128 for (int i = 0; i < 10; ++i) { 2129 #pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}} 2130 for (int i = 0; i < 10; ++i) 2131 ; 2132 } 2133 #pragma omp parallel for simd 2134 for (int i = 0; i < 10; ++i) { 2135 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2136 { 2137 bar(); 2138 } 2139 } 2140 #pragma omp parallel for simd 2141 for (int i = 0; i < 10; ++i) { 2142 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2143 { 2144 bar(); 2145 } 2146 } 2147 #pragma omp parallel for simd 2148 for (int i = 0; i < 10; ++i) { 2149 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2150 bar(); 2151 } 2152 #pragma omp parallel for simd 2153 for (int i = 0; i < 10; ++i) { 2154 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2155 bar(); 2156 } 2157 #pragma omp parallel for simd 2158 for (int i = 0; i < 10; ++i) { 2159 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2160 bar(); 2161 } 2162 #pragma omp parallel for simd 2163 for (int i = 0; i < 10; ++i) { 2164 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2165 bar(); 2166 } 2167 #pragma omp parallel for simd 2168 for (int i = 0; i < 10; ++i) { 2169 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2170 bar(); 2171 } 2172 #pragma omp parallel for simd 2173 for (int i = 0; i < 10; ++i) { 2174 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2175 bar(); 2176 } 2177 #pragma omp parallel for simd 2178 for (int i = 0; i < 10; ++i) { 2179 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2180 ++a; 2181 } 2182 #pragma omp parallel for simd 2183 for (int i = 0; i < 10; ++i) { 2184 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2185 ++a; 2186 } 2187 #pragma omp parallel for simd 2188 for (int i = 0; i < 10; ++i) { 2189 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2190 ++a; 2191 } 2192 #pragma omp parallel for simd 2193 for (int i = 0; i < 10; ++i) { 2194 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2195 for (int i = 0; i < 10; ++i) 2196 ; 2197 } 2198 #pragma omp parallel for simd 2199 for (int i = 0; i < 10; ++i) { 2200 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2201 ++a; 2202 } 2203 #pragma omp parallel for simd 2204 for (int i = 0; i < 10; ++i) { 2205 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2206 ++a; 2207 } 2208 #pragma omp parallel for simd 2209 for (int i = 0; i < 10; ++i) { 2210 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2211 ++a; 2212 } 2213 #pragma omp parallel for simd 2214 for (int i = 0; i < 10; ++i) { 2215 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2216 for (int i = 0; i < 10; ++i) 2217 ++a; 2218 } 2219 #pragma omp parallel for simd 2220 for (int i = 0; i < 10; ++i) { 2221 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2222 for (int j = 0; j < 10; ++j) 2223 ; 2224 } 2225 #pragma omp parallel for simd 2226 for (int i = 0; i < 10; ++i) { 2227 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2228 bar(); 2229 } 2230 #pragma omp parallel for simd 2231 for (int i = 0; i < 10; ++i) { 2232 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2233 for (int j = 0; j < 10; ++j) 2234 ; 2235 } 2236 #pragma omp parallel for simd 2237 for (int i = 0; i < 10; ++i) { 2238 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2239 for (int j = 0; j < 10; ++j) 2240 ; 2241 } 2242 #pragma omp parallel for simd 2243 for (int i = 0; i < 10; ++i) { 2244 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2245 for (int j = 0; j < 10; ++j) 2246 ; 2247 } 2248 2249 // PARALLEL SECTIONS DIRECTIVE 2250 #pragma omp parallel sections 2251 { 2252 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 2253 for (int i = 0; i < 10; ++i) 2254 ; 2255 } 2256 #pragma omp parallel sections 2257 { 2258 #pragma omp simd 2259 for (int i = 0; i < 10; ++i) 2260 ; 2261 } 2262 #pragma omp parallel sections 2263 { 2264 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 2265 for (int i = 0; i < 10; ++i) 2266 ; 2267 } 2268 #pragma omp parallel sections 2269 { 2270 #pragma omp parallel 2271 for (int i = 0; i < 10; ++i) 2272 ; 2273 } 2274 #pragma omp parallel sections 2275 { 2276 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 2277 { 2278 bar(); 2279 } 2280 } 2281 #pragma omp parallel sections 2282 { 2283 #pragma omp section 2284 { 2285 bar(); 2286 } 2287 } 2288 #pragma omp parallel sections 2289 { 2290 #pragma omp section 2291 { 2292 #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 2293 bar(); 2294 } 2295 } 2296 #pragma omp parallel sections 2297 { 2298 #pragma omp section 2299 { 2300 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}} 2301 bar(); 2302 } 2303 } 2304 #pragma omp parallel sections 2305 { 2306 #pragma omp section 2307 { 2308 #pragma omp critical 2309 bar(); 2310 } 2311 } 2312 #pragma omp parallel sections 2313 { 2314 #pragma omp parallel 2315 { 2316 #pragma omp single // OK 2317 { 2318 bar(); 2319 } 2320 #pragma omp for // OK 2321 for (int i = 0; i < 10; ++i) 2322 ; 2323 #pragma omp for simd // OK 2324 for (int i = 0; i < 10; ++i) 2325 ; 2326 #pragma omp sections // OK 2327 { 2328 bar(); 2329 } 2330 } 2331 } 2332 #pragma omp parallel sections 2333 { 2334 #pragma omp parallel for 2335 for (int i = 0; i < 10; ++i) 2336 ; 2337 } 2338 #pragma omp parallel sections 2339 { 2340 #pragma omp parallel for simd 2341 for (int i = 0; i < 10; ++i) 2342 ; 2343 } 2344 #pragma omp parallel sections 2345 { 2346 #pragma omp parallel sections 2347 { 2348 bar(); 2349 } 2350 } 2351 #pragma omp parallel sections 2352 { 2353 #pragma omp task 2354 { 2355 bar(); 2356 } 2357 } 2358 #pragma omp parallel sections 2359 { 2360 #pragma omp taskyield 2361 } 2362 #pragma omp parallel sections 2363 { 2364 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}} 2365 } 2366 #pragma omp parallel sections 2367 { 2368 #pragma omp taskwait 2369 } 2370 #pragma omp parallel sections 2371 { 2372 #pragma omp flush 2373 } 2374 #pragma omp parallel sections 2375 { 2376 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 2377 bar(); 2378 } 2379 #pragma omp parallel sections 2380 { 2381 #pragma omp atomic 2382 ++a; 2383 } 2384 #pragma omp parallel sections 2385 { 2386 #pragma omp target 2387 ++a; 2388 } 2389 #pragma omp parallel sections 2390 { 2391 #pragma omp target parallel 2392 ++a; 2393 } 2394 #pragma omp parallel sections 2395 { 2396 #pragma omp target parallel for 2397 for (int i = 0; i < 10; ++i) 2398 ; 2399 } 2400 #pragma omp parallel sections 2401 { 2402 #pragma omp target enter data map(to: a) 2403 } 2404 #pragma omp parallel sections 2405 { 2406 #pragma omp target exit data map(from: a) 2407 } 2408 #pragma omp parallel sections 2409 { 2410 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 2411 ++a; 2412 } 2413 #pragma omp parallel sections 2414 { 2415 #pragma omp taskloop 2416 for (int i = 0; i < 10; ++i) 2417 ++a; 2418 } 2419 #pragma omp parallel sections 2420 { 2421 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 2422 for (int i = 0; i < 10; ++i) 2423 ; 2424 } 2425 #pragma omp parallel sections 2426 { 2427 #pragma omp target update to(a) 2428 } 2429 #pragma omp parallel sections 2430 { 2431 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 2432 for (int i = 0; i < 10; ++i) 2433 ; 2434 } 2435 #pragma omp parallel sections 2436 { 2437 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 2438 for (int i = 0; i < 10; ++i) 2439 ; 2440 } 2441 #pragma omp parallel sections 2442 { 2443 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 2444 for (int i = 0; i < 10; ++i) 2445 ; 2446 } 2447 2448 // TASK DIRECTIVE 2449 #pragma omp task 2450 #pragma omp for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 2451 for (int i = 0; i < 10; ++i) 2452 ; 2453 #pragma omp task 2454 #pragma omp simd 2455 for (int i = 0; i < 10; ++i) 2456 ; 2457 #pragma omp task 2458 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 2459 for (int i = 0; i < 10; ++i) 2460 ; 2461 #pragma omp task 2462 #pragma omp sections // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 2463 { 2464 bar(); 2465 } 2466 #pragma omp task 2467 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a task region}} 2468 { 2469 bar(); 2470 } 2471 #pragma omp task 2472 #pragma omp single // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 2473 bar(); 2474 #pragma omp task 2475 #pragma omp master // expected-error {{region cannot be closely nested inside 'task' region}} 2476 bar(); 2477 #pragma omp task 2478 #pragma omp critical 2479 bar(); 2480 2481 #pragma omp task 2482 #pragma omp parallel for 2483 for (int i = 0; i < 10; ++i) 2484 ; 2485 #pragma omp task 2486 #pragma omp parallel for simd 2487 for (int i = 0; i < 10; ++i) 2488 ; 2489 #pragma omp task 2490 #pragma omp parallel sections 2491 { 2492 bar(); 2493 } 2494 #pragma omp task 2495 #pragma omp task 2496 { 2497 bar(); 2498 } 2499 #pragma omp task 2500 { 2501 #pragma omp taskyield 2502 bar(); 2503 } 2504 #pragma omp task 2505 { 2506 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}} 2507 bar(); 2508 } 2509 #pragma omp task 2510 { 2511 #pragma omp taskwait 2512 bar(); 2513 } 2514 #pragma omp task 2515 { 2516 #pragma omp flush 2517 bar(); 2518 } 2519 #pragma omp task 2520 { 2521 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 2522 bar(); 2523 } 2524 #pragma omp task 2525 { 2526 #pragma omp atomic 2527 ++a; 2528 } 2529 #pragma omp task 2530 { 2531 #pragma omp target 2532 ++a; 2533 } 2534 #pragma omp task 2535 { 2536 #pragma omp target parallel 2537 ++a; 2538 } 2539 #pragma omp task 2540 #pragma omp target parallel for 2541 for (int i = 0; i < 10; ++i) 2542 ; 2543 #pragma omp task 2544 { 2545 #pragma omp target enter data map(to: a) 2546 ++a; 2547 } 2548 #pragma omp task 2549 { 2550 #pragma omp target exit data map(from: a) 2551 ++a; 2552 } 2553 #pragma omp task 2554 { 2555 #pragma omp teams // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 2556 ++a; 2557 } 2558 #pragma omp task 2559 { 2560 #pragma omp taskloop 2561 for (int i = 0; i < 10; ++i) 2562 ++a; 2563 } 2564 #pragma omp task 2565 { 2566 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 2567 for (int i = 0; i < 10; ++i) 2568 ; 2569 } 2570 #pragma omp task 2571 { 2572 #pragma omp target update to(a) 2573 bar(); 2574 } 2575 #pragma omp task 2576 { 2577 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 2578 for (int i = 0; i < 10; ++i) 2579 ; 2580 } 2581 #pragma omp task 2582 { 2583 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 2584 for (int i = 0; i < 10; ++i) 2585 ; 2586 } 2587 #pragma omp task 2588 { 2589 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 2590 for (int i = 0; i < 10; ++i) 2591 ; 2592 } 2593 2594 // ORDERED DIRECTIVE 2595 #pragma omp ordered 2596 { 2597 #pragma omp for // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 2598 for (int i = 0; i < 10; ++i) 2599 ; 2600 } 2601 #pragma omp ordered 2602 { 2603 #pragma omp simd 2604 for (int i = 0; i < 10; ++i) 2605 ; 2606 } 2607 #pragma omp ordered 2608 { 2609 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 2610 for (int i = 0; i < 10; ++i) 2611 ; 2612 } 2613 #pragma omp ordered 2614 { 2615 #pragma omp parallel 2616 for (int i = 0; i < 10; ++i) 2617 ; 2618 } 2619 #pragma omp ordered 2620 { 2621 #pragma omp single // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 2622 { 2623 bar(); 2624 } 2625 } 2626 #pragma omp ordered 2627 { 2628 #pragma omp master // OK, though second 'ordered' is redundant 2629 { 2630 bar(); 2631 } 2632 } 2633 #pragma omp ordered 2634 { 2635 #pragma omp critical 2636 { 2637 bar(); 2638 } 2639 } 2640 #pragma omp ordered 2641 { 2642 #pragma omp sections // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 2643 { 2644 bar(); 2645 } 2646 } 2647 #pragma omp ordered 2648 { 2649 #pragma omp parallel for ordered 2650 for (int j = 0; j < 10; ++j) { 2651 #pragma omp ordered // OK 2652 { 2653 bar(); 2654 } 2655 } 2656 } 2657 #pragma omp ordered 2658 { 2659 #pragma omp parallel for simd ordered 2660 for (int j = 0; j < 10; ++j) { 2661 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 2662 { 2663 bar(); 2664 } 2665 } 2666 } 2667 #pragma omp ordered 2668 { 2669 #pragma omp parallel for simd ordered 2670 for (int j = 0; j < 10; ++j) { 2671 #pragma omp ordered simd 2672 { 2673 bar(); 2674 } 2675 } 2676 } 2677 #pragma omp ordered 2678 { 2679 #pragma omp parallel for 2680 for (int i = 0; i < 10; ++i) 2681 ; 2682 } 2683 #pragma omp ordered 2684 { 2685 #pragma omp parallel for simd 2686 for (int i = 0; i < 10; ++i) 2687 ; 2688 } 2689 #pragma omp ordered 2690 { 2691 #pragma omp parallel sections 2692 { 2693 bar(); 2694 } 2695 } 2696 #pragma omp ordered 2697 { 2698 #pragma omp task 2699 { 2700 bar(); 2701 } 2702 } 2703 #pragma omp ordered 2704 { 2705 #pragma omp taskyield 2706 bar(); 2707 } 2708 #pragma omp ordered 2709 { 2710 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'ordered' region}} 2711 bar(); 2712 } 2713 #pragma omp ordered 2714 { 2715 #pragma omp taskwait 2716 bar(); 2717 } 2718 #pragma omp ordered 2719 { 2720 #pragma omp flush 2721 bar(); 2722 } 2723 #pragma omp ordered 2724 { 2725 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 2726 bar(); 2727 } 2728 #pragma omp ordered 2729 { 2730 #pragma omp atomic 2731 ++a; 2732 } 2733 #pragma omp ordered 2734 { 2735 #pragma omp target 2736 ++a; 2737 } 2738 #pragma omp ordered 2739 { 2740 #pragma omp target parallel 2741 ++a; 2742 } 2743 #pragma omp ordered 2744 { 2745 #pragma omp target parallel for ordered 2746 for (int j = 0; j < 10; ++j) { 2747 #pragma omp ordered // OK 2748 { 2749 bar(); 2750 } 2751 } 2752 } 2753 #pragma omp ordered 2754 { 2755 #pragma omp target parallel for 2756 for (int i = 0; i < 10; ++i) 2757 ; 2758 } 2759 #pragma omp ordered 2760 { 2761 #pragma omp target enter data map(to: a) 2762 ++a; 2763 } 2764 #pragma omp ordered 2765 { 2766 #pragma omp target exit data map(from: a) 2767 ++a; 2768 } 2769 #pragma omp ordered 2770 { 2771 #pragma omp teams // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 2772 ++a; 2773 } 2774 #pragma omp ordered 2775 { 2776 #pragma omp taskloop 2777 for (int i = 0; i < 10; ++i) 2778 ++a; 2779 } 2780 #pragma omp ordered 2781 { 2782 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 2783 for (int i = 0; i < 10; ++i) 2784 ; 2785 } 2786 #pragma omp ordered 2787 { 2788 bar(); 2789 #pragma omp target update to(a) 2790 bar(); 2791 } 2792 #pragma omp ordered 2793 { 2794 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 2795 for (int i = 0; i < 10; ++i) 2796 ; 2797 } 2798 #pragma omp ordered 2799 { 2800 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 2801 for (int i = 0; i < 10; ++i) 2802 ; 2803 } 2804 #pragma omp ordered 2805 { 2806 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 2807 for (int i = 0; i < 10; ++i) 2808 ; 2809 } 2810 2811 // ATOMIC DIRECTIVE 2812 #pragma omp atomic 2813 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2814 // expected-note@+1 {{expected an expression statement}} 2815 { 2816 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2817 for (int i = 0; i < 10; ++i) 2818 ; 2819 } 2820 #pragma omp atomic 2821 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2822 // expected-note@+1 {{expected an expression statement}} 2823 { 2824 #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2825 for (int i = 0; i < 10; ++i) 2826 ; 2827 } 2828 #pragma omp atomic 2829 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2830 // expected-note@+1 {{expected an expression statement}} 2831 { 2832 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2833 for (int i = 0; i < 10; ++i) 2834 ; 2835 } 2836 #pragma omp atomic 2837 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2838 // expected-note@+1 {{expected an expression statement}} 2839 { 2840 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2841 for (int i = 0; i < 10; ++i) 2842 ; 2843 } 2844 #pragma omp atomic 2845 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2846 // expected-note@+1 {{expected an expression statement}} 2847 { 2848 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2849 { 2850 bar(); 2851 } 2852 } 2853 #pragma omp atomic 2854 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2855 // expected-note@+1 {{expected an expression statement}} 2856 { 2857 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2858 { 2859 bar(); 2860 } 2861 } 2862 #pragma omp atomic 2863 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2864 // expected-note@+1 {{expected an expression statement}} 2865 { 2866 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2867 { 2868 bar(); 2869 } 2870 } 2871 #pragma omp atomic 2872 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2873 // expected-note@+1 {{expected an expression statement}} 2874 { 2875 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2876 { 2877 bar(); 2878 } 2879 } 2880 #pragma omp atomic 2881 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2882 // expected-note@+1 {{expected an expression statement}} 2883 { 2884 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2885 { 2886 bar(); 2887 } 2888 } 2889 #pragma omp atomic 2890 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2891 // expected-note@+1 {{expected an expression statement}} 2892 { 2893 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2894 for (int i = 0; i < 10; ++i) 2895 ; 2896 } 2897 #pragma omp atomic 2898 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2899 // expected-note@+1 {{expected an expression statement}} 2900 { 2901 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2902 for (int i = 0; i < 10; ++i) 2903 ; 2904 } 2905 #pragma omp atomic 2906 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2907 // expected-note@+1 {{expected an expression statement}} 2908 { 2909 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2910 { 2911 bar(); 2912 } 2913 } 2914 #pragma omp atomic 2915 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2916 // expected-note@+1 {{expected an expression statement}} 2917 { 2918 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2919 { 2920 bar(); 2921 } 2922 } 2923 #pragma omp atomic 2924 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2925 // expected-note@+1 {{expected an expression statement}} 2926 { 2927 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2928 bar(); 2929 } 2930 #pragma omp atomic 2931 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2932 // expected-note@+1 {{expected an expression statement}} 2933 { 2934 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2935 bar(); 2936 } 2937 #pragma omp atomic 2938 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2939 // expected-note@+1 {{expected an expression statement}} 2940 { 2941 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2942 bar(); 2943 } 2944 #pragma omp atomic 2945 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2946 // expected-note@+1 {{expected an expression statement}} 2947 { 2948 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2949 bar(); 2950 } 2951 #pragma omp atomic 2952 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2953 // expected-note@+1 {{expected an expression statement}} 2954 { 2955 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2956 bar(); 2957 } 2958 #pragma omp atomic 2959 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2960 // expected-note@+1 {{expected an expression statement}} 2961 { 2962 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2963 ++a; 2964 } 2965 #pragma omp atomic 2966 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2967 // expected-note@+1 {{expected an expression statement}} 2968 { 2969 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2970 ++a; 2971 } 2972 #pragma omp atomic 2973 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2974 // expected-note@+1 {{expected an expression statement}} 2975 { 2976 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2977 ++a; 2978 } 2979 #pragma omp atomic 2980 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2981 // expected-note@+1 {{expected an expression statement}} 2982 { 2983 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2984 for (int i = 0; i < 10; ++i) 2985 ; 2986 } 2987 #pragma omp atomic 2988 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2989 // expected-note@+1 {{expected an expression statement}} 2990 { 2991 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2992 ++a; 2993 } 2994 #pragma omp atomic 2995 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 2996 // expected-note@+1 {{expected an expression statement}} 2997 { 2998 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 2999 ++a; 3000 } 3001 #pragma omp atomic 3002 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 3003 // expected-note@+1 {{expected an expression statement}} 3004 { 3005 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 3006 ++a; 3007 } 3008 #pragma omp atomic 3009 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 3010 // expected-note@+1 {{expected an expression statement}} 3011 { 3012 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 3013 for (int i = 0; i < 10; ++i) 3014 ++a; 3015 } 3016 #pragma omp atomic 3017 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 3018 // expected-note@+1 {{expected an expression statement}} 3019 { 3020 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 3021 for (int i = 0; i < 10; ++i) 3022 ; 3023 } 3024 #pragma omp atomic 3025 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 3026 // expected-note@+1 {{expected an expression statement}} 3027 { 3028 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 3029 bar(); 3030 } 3031 #pragma omp atomic 3032 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 3033 // expected-note@+1 {{expected an expression statement}} 3034 { 3035 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 3036 for (int i = 0; i < 10; ++i) 3037 ; 3038 } 3039 #pragma omp atomic 3040 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 3041 // expected-note@+1 {{expected an expression statement}} 3042 { 3043 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 3044 for (int i = 0; i < 10; ++i) 3045 ; 3046 } 3047 #pragma omp atomic 3048 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 3049 // expected-note@+1 {{expected an expression statement}} 3050 { 3051 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 3052 for (int i = 0; i < 10; ++i) 3053 ; 3054 } 3055 3056 // TARGET DIRECTIVE 3057 #pragma omp target 3058 #pragma omp parallel 3059 bar(); 3060 #pragma omp target 3061 #pragma omp for 3062 for (int i = 0; i < 10; ++i) 3063 ; 3064 #pragma omp target 3065 #pragma omp simd 3066 for (int i = 0; i < 10; ++i) 3067 ; 3068 #pragma omp target 3069 #pragma omp for simd 3070 for (int i = 0; i < 10; ++i) 3071 ; 3072 #pragma omp target 3073 #pragma omp sections 3074 { 3075 bar(); 3076 } 3077 #pragma omp target 3078 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target region}} 3079 { 3080 bar(); 3081 } 3082 #pragma omp target 3083 #pragma omp single 3084 bar(); 3085 3086 #pragma omp target 3087 #pragma omp master 3088 { 3089 bar(); 3090 } 3091 #pragma omp target 3092 #pragma omp critical 3093 { 3094 bar(); 3095 } 3096 #pragma omp target 3097 #pragma omp parallel for 3098 for (int i = 0; i < 10; ++i) 3099 ; 3100 #pragma omp target 3101 #pragma omp parallel for simd 3102 for (int i = 0; i < 10; ++i) 3103 ; 3104 #pragma omp target 3105 #pragma omp parallel sections 3106 { 3107 bar(); 3108 } 3109 #pragma omp target 3110 #pragma omp task 3111 { 3112 bar(); 3113 } 3114 #pragma omp target 3115 { 3116 #pragma omp taskyield 3117 bar(); 3118 } 3119 #pragma omp target 3120 { 3121 #pragma omp barrier 3122 bar(); 3123 } 3124 #pragma omp target 3125 { 3126 #pragma omp taskwait 3127 bar(); 3128 } 3129 #pragma omp target 3130 { 3131 #pragma omp flush 3132 bar(); 3133 } 3134 #pragma omp target 3135 { 3136 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 3137 bar(); 3138 } 3139 #pragma omp target 3140 { 3141 #pragma omp atomic 3142 ++a; 3143 } 3144 #pragma omp target 3145 { 3146 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}} 3147 ++a; 3148 } 3149 #pragma omp target 3150 { 3151 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}} 3152 ++a; 3153 } 3154 #pragma omp target 3155 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}} 3156 for (int i = 0; i < 10; ++i) 3157 ; 3158 #pragma omp target 3159 { 3160 #pragma omp teams 3161 ++a; 3162 } 3163 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} 3164 { 3165 ++a; // expected-note {{statement outside teams construct here}} 3166 #pragma omp teams // expected-note {{nested teams construct here}} 3167 ++a; 3168 } 3169 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} 3170 { 3171 while (0) // expected-note {{statement outside teams construct here}} 3172 #pragma omp teams // expected-note {{nested teams construct here}} 3173 ++a; 3174 } 3175 #pragma omp target 3176 { 3177 #pragma omp taskloop 3178 for (int i = 0; i < 10; ++i) 3179 ++a; 3180 } 3181 #pragma omp target 3182 { 3183 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 3184 for (int i = 0; i < 10; ++i) 3185 ; 3186 } 3187 #pragma omp target 3188 { 3189 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}} 3190 } 3191 #pragma omp target 3192 { 3193 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}} 3194 } 3195 #pragma omp target 3196 { 3197 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}} 3198 } 3199 #pragma omp target 3200 { 3201 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 3202 for (int i = 0; i < 10; ++i) 3203 ; 3204 } 3205 #pragma omp target 3206 { 3207 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 3208 for (int i = 0; i < 10; ++i) 3209 ; 3210 } 3211 #pragma omp target 3212 { 3213 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 3214 for (int i = 0; i < 10; ++i) 3215 ; 3216 } 3217 3218 // TARGET PARALLEL DIRECTIVE 3219 #pragma omp target parallel 3220 #pragma omp parallel 3221 bar(); 3222 #pragma omp target parallel 3223 #pragma omp for 3224 for (int i = 0; i < 10; ++i) 3225 ; 3226 #pragma omp target parallel 3227 #pragma omp simd 3228 for (int i = 0; i < 10; ++i) 3229 ; 3230 #pragma omp target parallel 3231 #pragma omp for simd 3232 for (int i = 0; i < 10; ++i) 3233 ; 3234 #pragma omp target parallel 3235 #pragma omp sections 3236 { 3237 bar(); 3238 } 3239 #pragma omp target parallel 3240 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel region}} 3241 { 3242 bar(); 3243 } 3244 #pragma omp target parallel 3245 #pragma omp single 3246 bar(); 3247 3248 #pragma omp target parallel 3249 #pragma omp master 3250 { 3251 bar(); 3252 } 3253 #pragma omp target parallel 3254 #pragma omp critical 3255 { 3256 bar(); 3257 } 3258 #pragma omp target parallel 3259 #pragma omp parallel for 3260 for (int i = 0; i < 10; ++i) 3261 ; 3262 #pragma omp target parallel 3263 #pragma omp parallel for simd 3264 for (int i = 0; i < 10; ++i) 3265 ; 3266 #pragma omp target parallel 3267 #pragma omp parallel sections 3268 { 3269 bar(); 3270 } 3271 #pragma omp target parallel 3272 #pragma omp task 3273 { 3274 bar(); 3275 } 3276 #pragma omp target parallel 3277 { 3278 #pragma omp taskyield 3279 bar(); 3280 } 3281 #pragma omp target parallel 3282 { 3283 #pragma omp barrier 3284 bar(); 3285 } 3286 #pragma omp target parallel 3287 { 3288 #pragma omp taskwait 3289 bar(); 3290 } 3291 #pragma omp target parallel 3292 { 3293 #pragma omp flush 3294 bar(); 3295 } 3296 #pragma omp target parallel 3297 { 3298 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 3299 bar(); 3300 } 3301 #pragma omp target parallel 3302 { 3303 #pragma omp atomic 3304 ++a; 3305 } 3306 #pragma omp target parallel 3307 { 3308 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel' region}} 3309 ++a; 3310 } 3311 #pragma omp target parallel 3312 { 3313 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel' region}} 3314 ++a; 3315 } 3316 #pragma omp target parallel 3317 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel' region}} 3318 for (int i = 0; i < 10; ++i) 3319 ; 3320 #pragma omp target parallel 3321 { 3322 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 3323 ++a; 3324 } 3325 #pragma omp target parallel 3326 { 3327 ++a; 3328 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 3329 ++a; 3330 } 3331 #pragma omp target parallel 3332 { 3333 #pragma omp taskloop 3334 for (int i = 0; i < 10; ++i) 3335 ++a; 3336 } 3337 #pragma omp target parallel 3338 { 3339 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 3340 for (int i = 0; i < 10; ++i) 3341 ; 3342 } 3343 #pragma omp target parallel 3344 { 3345 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel' region}} 3346 } 3347 #pragma omp target parallel 3348 { 3349 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel' region}} 3350 } 3351 #pragma omp target parallel 3352 { 3353 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel' region}} 3354 } 3355 #pragma omp target parallel 3356 { 3357 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 3358 for (int i = 0; i < 10; ++i) 3359 ; 3360 } 3361 #pragma omp target parallel 3362 { 3363 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 3364 for (int i = 0; i < 10; ++i) 3365 ; 3366 } 3367 #pragma omp target parallel 3368 { 3369 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 3370 for (int i = 0; i < 10; ++i) 3371 ; 3372 } 3373 3374 // TARGET PARALLEL FOR DIRECTIVE 3375 #pragma omp target parallel for 3376 for (int i = 0; i < 10; ++i) { 3377 #pragma omp for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 3378 for (int i = 0; i < 10; ++i) 3379 ; 3380 } 3381 #pragma omp target parallel for 3382 for (int i = 0; i < 10; ++i) { 3383 #pragma omp simd 3384 for (int i = 0; i < 10; ++i) 3385 ; 3386 } 3387 #pragma omp target parallel for 3388 for (int i = 0; i < 10; ++i) { 3389 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 3390 for (int i = 0; i < 10; ++i) 3391 ; 3392 } 3393 #pragma omp target parallel for 3394 for (int i = 0; i < 10; ++i) { 3395 #pragma omp parallel 3396 for (int i = 0; i < 10; ++i) 3397 ; 3398 } 3399 #pragma omp target parallel for 3400 for (int i = 0; i < 10; ++i) { 3401 #pragma omp sections // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 3402 { 3403 bar(); 3404 } 3405 } 3406 #pragma omp target parallel for 3407 for (int i = 0; i < 10; ++i) { 3408 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel for region}} 3409 { 3410 bar(); 3411 } 3412 } 3413 #pragma omp target parallel for 3414 for (int i = 0; i < 10; ++i) { 3415 #pragma omp single // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 3416 { 3417 bar(); 3418 } 3419 } 3420 3421 #pragma omp target parallel for 3422 for (int i = 0; i < 10; ++i) { 3423 #pragma omp master // expected-error {{region cannot be closely nested inside 'target parallel for' region}} 3424 { 3425 bar(); 3426 } 3427 } 3428 3429 #pragma omp target parallel for 3430 for (int i = 0; i < 10; ++i) { 3431 #pragma omp critical 3432 { 3433 bar(); 3434 } 3435 } 3436 3437 #pragma omp target parallel for 3438 for (int i = 0; i < 10; ++i) { 3439 #pragma omp parallel 3440 { 3441 #pragma omp single // OK 3442 { 3443 bar(); 3444 } 3445 #pragma omp for // OK 3446 for (int i = 0; i < 10; ++i) 3447 ; 3448 #pragma omp for simd // OK 3449 for (int i = 0; i < 10; ++i) 3450 ; 3451 #pragma omp sections // OK 3452 { 3453 bar(); 3454 } 3455 } 3456 } 3457 #pragma omp target parallel for 3458 for (int i = 0; i < 10; ++i) { 3459 #pragma omp parallel for 3460 for (int i = 0; i < 10; ++i) 3461 ; 3462 } 3463 #pragma omp target parallel for 3464 for (int i = 0; i < 10; ++i) { 3465 #pragma omp parallel for simd 3466 for (int i = 0; i < 10; ++i) 3467 ; 3468 } 3469 #pragma omp target parallel for 3470 for (int i = 0; i < 10; ++i) { 3471 #pragma omp parallel sections 3472 { 3473 bar(); 3474 } 3475 } 3476 #pragma omp target parallel for 3477 for (int i = 0; i < 10; ++i) { 3478 #pragma omp task 3479 { 3480 bar(); 3481 } 3482 } 3483 #pragma omp target parallel for 3484 for (int i = 0; i < 10; ++i) { 3485 #pragma omp taskyield 3486 bar(); 3487 } 3488 #pragma omp target parallel for 3489 for (int i = 0; i < 10; ++i) { 3490 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target parallel for' region}} 3491 bar(); 3492 } 3493 #pragma omp target parallel for 3494 for (int i = 0; i < 10; ++i) { 3495 #pragma omp taskwait 3496 bar(); 3497 } 3498 #pragma omp target parallel for 3499 for (int i = 0; i < 10; ++i) { 3500 #pragma omp flush 3501 bar(); 3502 } 3503 #pragma omp target parallel for 3504 for (int i = 0; i < 10; ++i) { 3505 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 3506 bar(); 3507 } 3508 #pragma omp target parallel for ordered 3509 for (int i = 0; i < 10; ++i) { 3510 #pragma omp ordered // OK 3511 bar(); 3512 } 3513 #pragma omp target parallel for 3514 for (int i = 0; i < 10; ++i) { 3515 #pragma omp atomic 3516 ++a; 3517 } 3518 #pragma omp target parallel for 3519 for (int i = 0; i < 10; ++i) { 3520 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel for' region}} 3521 ++a; 3522 } 3523 #pragma omp target parallel for 3524 for (int i = 0; i < 10; ++i) { 3525 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel for' region}} 3526 ++a; 3527 } 3528 #pragma omp target parallel for 3529 for (int i = 0; i < 10; ++i) { 3530 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}} 3531 for (int i = 0; i < 10; ++i) 3532 ; 3533 } 3534 #pragma omp target parallel for 3535 for (int i = 0; i < 10; ++i) { 3536 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel for' region}} 3537 ++a; 3538 } 3539 #pragma omp target parallel for 3540 for (int i = 0; i < 10; ++i) { 3541 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel for' region}} 3542 ++a; 3543 } 3544 #pragma omp target parallel for 3545 for (int i = 0; i < 10; ++i) { 3546 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 3547 ++a; 3548 } 3549 #pragma omp target parallel for 3550 for (int i = 0; i < 10; ++i) { 3551 #pragma omp taskloop 3552 for (int i = 0; i < 10; ++i) 3553 ++a; 3554 } 3555 #pragma omp target parallel for 3556 for (int i = 0; i < 10; ++i) { 3557 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 3558 for (int j = 0; j < 10; ++j) 3559 ; 3560 } 3561 #pragma omp target parallel for 3562 for (int i = 0; i < 10; ++i) { 3563 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel for' region}} 3564 } 3565 #pragma omp target parallel for 3566 for (int i = 0; i < 10; ++i) { 3567 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 3568 for (int j = 0; j < 10; ++j) 3569 ; 3570 } 3571 #pragma omp target parallel for 3572 for (int i = 0; i < 10; ++i) { 3573 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 3574 for (int j = 0; j < 10; ++j) 3575 ; 3576 } 3577 #pragma omp target parallel for 3578 for (int i = 0; i < 10; ++i) { 3579 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 3580 for (int j = 0; j < 10; ++j) 3581 ; 3582 } 3583 3584 // TEAMS DIRECTIVE 3585 #pragma omp target 3586 #pragma omp teams 3587 #pragma omp parallel 3588 bar(); 3589 #pragma omp target 3590 #pragma omp teams 3591 #pragma omp for // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 3592 for (int i = 0; i < 10; ++i) 3593 ; 3594 #pragma omp target 3595 #pragma omp teams 3596 #pragma omp simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp simd' directive into a parallel region?}} 3597 for (int i = 0; i < 10; ++i) 3598 ; 3599 #pragma omp target 3600 #pragma omp teams 3601 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 3602 for (int i = 0; i < 10; ++i) 3603 ; 3604 #pragma omp target 3605 #pragma omp teams 3606 #pragma omp sections // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 3607 { 3608 bar(); 3609 } 3610 #pragma omp target 3611 #pragma omp teams 3612 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams region}} 3613 { 3614 bar(); 3615 } 3616 #pragma omp target 3617 #pragma omp teams 3618 #pragma omp single // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 3619 bar(); 3620 3621 #pragma omp target 3622 #pragma omp teams 3623 #pragma omp master // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp master' directive into a parallel region?}} 3624 { 3625 bar(); 3626 } 3627 #pragma omp target 3628 #pragma omp teams 3629 #pragma omp critical // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp critical' directive into a parallel region?}} 3630 { 3631 bar(); 3632 } 3633 #pragma omp target 3634 #pragma omp teams 3635 #pragma omp parallel for 3636 for (int i = 0; i < 10; ++i) 3637 ; 3638 #pragma omp target 3639 #pragma omp teams 3640 #pragma omp parallel for simd 3641 for (int i = 0; i < 10; ++i) 3642 ; 3643 #pragma omp target 3644 #pragma omp teams 3645 #pragma omp parallel sections 3646 { 3647 bar(); 3648 } 3649 #pragma omp target 3650 #pragma omp teams 3651 #pragma omp task // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp task' directive into a parallel region?}} 3652 { 3653 bar(); 3654 } 3655 #pragma omp target 3656 #pragma omp teams 3657 { 3658 #pragma omp taskyield // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskyield' directive into a parallel region?}} 3659 bar(); 3660 } 3661 #pragma omp target 3662 #pragma omp teams 3663 { 3664 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp barrier' directive into a parallel region?}} 3665 bar(); 3666 } 3667 #pragma omp target 3668 #pragma omp teams 3669 { 3670 #pragma omp taskwait // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskwait' directive into a parallel region?}} 3671 bar(); 3672 } 3673 #pragma omp target 3674 #pragma omp teams 3675 { 3676 #pragma omp flush // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp flush' directive into a parallel region?}} 3677 bar(); 3678 } 3679 #pragma omp target 3680 #pragma omp teams 3681 { 3682 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 3683 bar(); 3684 } 3685 #pragma omp target 3686 #pragma omp teams 3687 { 3688 #pragma omp atomic // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp atomic' directive into a parallel region?}} 3689 ++a; 3690 } 3691 #pragma omp target 3692 #pragma omp teams 3693 { 3694 #pragma omp target // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target' directive into a parallel region?}} 3695 ++a; 3696 } 3697 #pragma omp target 3698 #pragma omp teams 3699 { 3700 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}} 3701 ++a; 3702 } 3703 #pragma omp target 3704 #pragma omp teams 3705 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}} 3706 for (int i = 0; i < 10; ++i) 3707 ; 3708 #pragma omp target 3709 #pragma omp teams 3710 { 3711 #pragma omp target enter data map(to: a) // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target enter data' directive into a parallel region?}} 3712 ++a; 3713 } 3714 #pragma omp target 3715 #pragma omp teams 3716 { 3717 #pragma omp target exit data map(from: a) // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target exit data' directive into a parallel region?}} 3718 ++a; 3719 } 3720 #pragma omp target 3721 #pragma omp teams 3722 { 3723 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 3724 ++a; 3725 } 3726 #pragma omp target 3727 #pragma omp teams 3728 { 3729 #pragma omp taskloop // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskloop' directive into a parallel region?}} 3730 for (int i = 0; i < 10; ++i) 3731 ++a; 3732 } 3733 #pragma omp target 3734 #pragma omp teams 3735 #pragma omp distribute 3736 for (int i = 0; i < 10; ++i) 3737 ; 3738 #pragma omp target 3739 #pragma omp teams 3740 #pragma omp distribute 3741 for (int i = 0; i < 10; ++i) 3742 ; 3743 #pragma omp distribute 3744 for (int j = 0; j < 10; ++j) 3745 ; 3746 #pragma omp target 3747 #pragma omp teams 3748 { 3749 #pragma omp target update to(a) // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target update' directive into a parallel region?}} 3750 } 3751 #pragma omp target 3752 #pragma omp teams 3753 { 3754 #pragma omp distribute parallel for 3755 for (int i = 0; i < 10; ++i) 3756 ; 3757 #pragma omp distribute parallel for 3758 for (int j = 0; j < 10; ++j) 3759 ; 3760 } 3761 #pragma omp target 3762 #pragma omp teams 3763 { 3764 #pragma omp distribute parallel for simd 3765 for (int i = 0; i < 10; ++i) 3766 ; 3767 #pragma omp distribute parallel for simd 3768 for (int j = 0; j < 10; ++j) 3769 ; 3770 } 3771 #pragma omp target 3772 #pragma omp teams 3773 { 3774 #pragma omp distribute simd 3775 for (int i = 0; i < 10; ++i) 3776 ; 3777 #pragma omp distribute simd 3778 for (int j = 0; j < 10; ++j) 3779 ; 3780 } 3781 3782 // TASKLOOP DIRECTIVE 3783 #pragma omp taskloop 3784 for (int i = 0; i < 10; ++i) { 3785 #pragma omp for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 3786 for (int i = 0; i < 10; ++i) 3787 ; 3788 } 3789 #pragma omp taskloop 3790 for (int i = 0; i < 10; ++i) { 3791 #pragma omp simd 3792 for (int i = 0; i < 10; ++i) 3793 ; 3794 } 3795 #pragma omp taskloop 3796 for (int i = 0; i < 10; ++i) { 3797 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 3798 for (int i = 0; i < 10; ++i) 3799 ; 3800 } 3801 #pragma omp taskloop 3802 for (int i = 0; i < 10; ++i) { 3803 #pragma omp parallel 3804 for (int i = 0; i < 10; ++i) 3805 ; 3806 } 3807 #pragma omp taskloop 3808 for (int i = 0; i < 10; ++i) { 3809 #pragma omp sections // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 3810 { 3811 bar(); 3812 } 3813 } 3814 #pragma omp taskloop 3815 for (int i = 0; i < 10; ++i) { 3816 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a taskloop region}} 3817 { 3818 bar(); 3819 } 3820 } 3821 #pragma omp taskloop 3822 for (int i = 0; i < 10; ++i) { 3823 #pragma omp single // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 3824 { 3825 bar(); 3826 } 3827 } 3828 3829 #pragma omp taskloop 3830 for (int i = 0; i < 10; ++i) { 3831 #pragma omp master // expected-error {{region cannot be closely nested inside 'taskloop' region}} 3832 { 3833 bar(); 3834 } 3835 } 3836 #pragma omp taskloop 3837 for (int i = 0; i < 10; ++i) { 3838 #pragma omp critical 3839 { 3840 bar(); 3841 } 3842 } 3843 #pragma omp taskloop 3844 for (int i = 0; i < 10; ++i) { 3845 #pragma omp parallel 3846 { 3847 #pragma omp single // OK 3848 { 3849 bar(); 3850 } 3851 #pragma omp for // OK 3852 for (int i = 0; i < 10; ++i) 3853 ; 3854 #pragma omp sections // OK 3855 { 3856 bar(); 3857 } 3858 } 3859 } 3860 #pragma omp taskloop 3861 for (int i = 0; i < 10; ++i) { 3862 #pragma omp parallel for 3863 for (int i = 0; i < 10; ++i) 3864 ; 3865 } 3866 #pragma omp taskloop 3867 for (int i = 0; i < 10; ++i) { 3868 #pragma omp parallel for simd 3869 for (int i = 0; i < 10; ++i) 3870 ; 3871 } 3872 #pragma omp taskloop 3873 for (int i = 0; i < 10; ++i) { 3874 #pragma omp parallel sections 3875 { 3876 bar(); 3877 } 3878 } 3879 #pragma omp taskloop 3880 for (int i = 0; i < 10; ++i) { 3881 #pragma omp task 3882 { 3883 bar(); 3884 } 3885 } 3886 #pragma omp taskloop 3887 for (int i = 0; i < 10; ++i) { 3888 #pragma omp taskyield 3889 bar(); 3890 } 3891 #pragma omp taskloop 3892 for (int i = 0; i < 10; ++i) { 3893 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'taskloop' region}} 3894 bar(); 3895 } 3896 #pragma omp taskloop 3897 for (int i = 0; i < 10; ++i) { 3898 #pragma omp taskwait 3899 bar(); 3900 } 3901 #pragma omp taskloop 3902 for (int i = 0; i < 10; ++i) { 3903 #pragma omp flush 3904 bar(); 3905 } 3906 #pragma omp taskloop 3907 for (int i = 0; i < 10; ++i) { 3908 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 3909 bar(); 3910 } 3911 #pragma omp taskloop 3912 for (int i = 0; i < 10; ++i) { 3913 #pragma omp atomic 3914 ++a; 3915 } 3916 #pragma omp taskloop 3917 for (int i = 0; i < 10; ++i) { 3918 #pragma omp target 3919 ++a; 3920 } 3921 #pragma omp taskloop 3922 for (int i = 0; i < 10; ++i) { 3923 #pragma omp target parallel 3924 ++a; 3925 } 3926 #pragma omp taskloop 3927 for (int i = 0; i < 10; ++i) { 3928 #pragma omp target parallel for 3929 for (int i = 0; i < 10; ++i) 3930 ; 3931 } 3932 #pragma omp taskloop 3933 for (int i = 0; i < 10; ++i) { 3934 #pragma omp target enter data map(to: a) 3935 ++a; 3936 } 3937 #pragma omp taskloop 3938 for (int i = 0; i < 10; ++i) { 3939 #pragma omp target exit data map(from: a) 3940 ++a; 3941 } 3942 #pragma omp taskloop 3943 for (int i = 0; i < 10; ++i) { 3944 #pragma omp teams // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 3945 ++a; 3946 } 3947 #pragma omp taskloop 3948 for (int i = 0; i < 10; ++i) { 3949 #pragma omp taskloop 3950 for (int i = 0; i < 10; ++i) 3951 ++a; 3952 } 3953 #pragma omp taskloop 3954 for (int i = 0; i < 10; ++i) { 3955 #pragma omp target update to(a) 3956 bar(); 3957 } 3958 #pragma omp taskloop 3959 for (int i = 0; i < 10; ++i) { 3960 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 3961 for (int j = 0; j < 10; ++j) 3962 ++a; 3963 } 3964 #pragma omp taskloop 3965 for (int i = 0; i < 10; ++i) { 3966 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 3967 for (int j = 0; j < 10; ++j) 3968 ++a; 3969 } 3970 #pragma omp taskloop 3971 for (int i = 0; i < 10; ++i) { 3972 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 3973 for (int j = 0; j < 10; ++j) 3974 ++a; 3975 } 3976 #pragma omp taskloop 3977 for (int i = 0; i < 10; ++i) { 3978 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 3979 for (int j = 0; j < 10; ++j) 3980 ++a; 3981 } 3982 3983 // DISTRIBUTE DIRECTIVE 3984 #pragma omp target 3985 #pragma omp teams 3986 #pragma omp distribute 3987 for (int i = 0; i < 10; ++i) { 3988 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 3989 for (int i = 0; i < 10; ++i) 3990 ; 3991 } 3992 #pragma omp target 3993 #pragma omp teams 3994 #pragma omp distribute 3995 for (int i = 0; i < 10; ++i) { 3996 #pragma omp for 3997 for (int i = 0; i < 10; ++i) 3998 ; 3999 } 4000 #pragma omp target 4001 #pragma omp teams 4002 #pragma omp distribute 4003 for (int i = 0; i < 10; ++i) { 4004 #pragma omp simd 4005 for (int i = 0; i < 10; ++i) 4006 ; 4007 } 4008 #pragma omp target 4009 #pragma omp teams 4010 #pragma omp distribute 4011 for (int i = 0; i < 10; ++i) { 4012 #pragma omp for simd 4013 for (int i = 0; i < 10; ++i) 4014 ; 4015 } 4016 #pragma omp target 4017 #pragma omp teams 4018 #pragma omp distribute 4019 for (int i = 0; i < 10; ++i) { 4020 #pragma omp parallel 4021 for (int i = 0; i < 10; ++i) 4022 ; 4023 } 4024 #pragma omp target 4025 #pragma omp teams 4026 #pragma omp distribute 4027 for (int i = 0; i < 10; ++i) { 4028 #pragma omp sections 4029 { 4030 bar(); 4031 } 4032 } 4033 #pragma omp target 4034 #pragma omp teams 4035 #pragma omp distribute 4036 for (int i = 0; i < 10; ++i) { 4037 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute region}} 4038 { 4039 bar(); 4040 } 4041 } 4042 #pragma omp target 4043 #pragma omp teams 4044 #pragma omp distribute 4045 for (int i = 0; i < 10; ++i) { 4046 #pragma omp single 4047 { 4048 bar(); 4049 } 4050 } 4051 #pragma omp target 4052 #pragma omp teams 4053 #pragma omp distribute 4054 for (int i = 0; i < 10; ++i) { 4055 #pragma omp master 4056 { 4057 bar(); 4058 } 4059 } 4060 #pragma omp target 4061 #pragma omp teams 4062 #pragma omp distribute 4063 for (int i = 0; i < 10; ++i) { 4064 #pragma omp critical 4065 { 4066 bar(); 4067 } 4068 } 4069 #pragma omp target 4070 #pragma omp teams 4071 #pragma omp distribute 4072 for (int i = 0; i < 10; ++i) { 4073 #pragma omp parallel 4074 { 4075 #pragma omp single 4076 { 4077 bar(); 4078 } 4079 } 4080 } 4081 #pragma omp target 4082 #pragma omp teams 4083 #pragma omp distribute 4084 for (int i = 0; i < 10; ++i) { 4085 #pragma omp parallel for 4086 for (int i = 0; i < 10; ++i) 4087 ; 4088 } 4089 #pragma omp target 4090 #pragma omp teams 4091 #pragma omp distribute 4092 for (int i = 0; i < 10; ++i) { 4093 #pragma omp parallel for simd 4094 for (int i = 0; i < 10; ++i) 4095 ; 4096 } 4097 #pragma omp target 4098 #pragma omp teams 4099 #pragma omp distribute 4100 for (int i = 0; i < 10; ++i) { 4101 #pragma omp parallel sections 4102 { 4103 bar(); 4104 } 4105 } 4106 #pragma omp target 4107 #pragma omp teams 4108 #pragma omp distribute 4109 for (int i = 0; i < 10; ++i) { 4110 #pragma omp task 4111 { 4112 bar(); 4113 } 4114 } 4115 #pragma omp target 4116 #pragma omp teams 4117 #pragma omp distribute 4118 for (int i = 0; i < 10; ++i) { 4119 #pragma omp taskyield 4120 bar(); 4121 } 4122 #pragma omp target 4123 #pragma omp teams 4124 #pragma omp distribute 4125 for (int i = 0; i < 10; ++i) { 4126 #pragma omp barrier 4127 bar(); 4128 } 4129 #pragma omp target 4130 #pragma omp teams 4131 #pragma omp distribute 4132 for (int i = 0; i < 10; ++i) { 4133 #pragma omp taskwait 4134 bar(); 4135 } 4136 #pragma omp target 4137 #pragma omp teams 4138 #pragma omp distribute 4139 for (int i = 0; i < 10; ++i) { 4140 #pragma omp flush 4141 bar(); 4142 } 4143 #pragma omp target 4144 #pragma omp teams 4145 #pragma omp distribute 4146 for (int i = 0; i < 10; ++i) { 4147 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 4148 bar(); 4149 } 4150 #pragma omp target 4151 #pragma omp teams 4152 #pragma omp distribute 4153 for (int i = 0; i < 10; ++i) { 4154 #pragma omp atomic 4155 ++a; 4156 } 4157 #pragma omp target 4158 #pragma omp teams 4159 #pragma omp distribute 4160 for (int i = 0; i < 10; ++i) { 4161 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}} 4162 ++a; 4163 } 4164 #pragma omp target 4165 #pragma omp teams 4166 #pragma omp distribute 4167 for (int i = 0; i < 10; ++i) { 4168 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}} 4169 ++a; 4170 } 4171 #pragma omp target 4172 #pragma omp teams 4173 #pragma omp distribute 4174 for (int i = 0; i < 10; ++i) { 4175 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}} 4176 for (int i = 0; i < 10; ++i) 4177 ; 4178 } 4179 #pragma omp target 4180 #pragma omp teams 4181 #pragma omp distribute 4182 for (int i = 0; i < 10; ++i) { 4183 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}} 4184 ++a; 4185 } 4186 #pragma omp target 4187 #pragma omp teams 4188 #pragma omp distribute 4189 for (int i = 0; i < 10; ++i) { 4190 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}} 4191 ++a; 4192 } 4193 #pragma omp target 4194 #pragma omp teams 4195 #pragma omp distribute 4196 for (int i = 0; i < 10; ++i) { 4197 #pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 4198 ++a; 4199 } 4200 #pragma omp target 4201 #pragma omp teams 4202 #pragma omp distribute 4203 for (int i = 0; i < 10; ++i) { 4204 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}} 4205 ++a; 4206 } 4207 4208 // DISTRIBUTE PARALLEL FOR DIRECTIVE 4209 #pragma omp target 4210 #pragma omp teams 4211 #pragma omp distribute parallel for 4212 for (int i = 0; i < 10; ++i) { 4213 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 4214 for (int i = 0; i < 10; ++i) 4215 ; 4216 } 4217 #pragma omp target 4218 #pragma omp teams 4219 #pragma omp distribute parallel for 4220 for (int i = 0; i < 10; ++i) { 4221 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 4222 for (int i = 0; i < 10; ++i) 4223 ; 4224 } 4225 #pragma omp target 4226 #pragma omp teams 4227 #pragma omp distribute parallel for 4228 for (int i = 0; i < 10; ++i) { 4229 #pragma omp for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 4230 for (int i = 0; i < 10; ++i) 4231 ; 4232 } 4233 #pragma omp target 4234 #pragma omp teams 4235 #pragma omp distribute parallel for 4236 for (int i = 0; i < 10; ++i) { 4237 #pragma omp simd 4238 for (int i = 0; i < 10; ++i) 4239 ; 4240 } 4241 #pragma omp target 4242 #pragma omp teams 4243 #pragma omp distribute parallel for 4244 for (int i = 0; i < 10; ++i) { 4245 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 4246 for (int i = 0; i < 10; ++i) 4247 ; 4248 } 4249 #pragma omp target 4250 #pragma omp teams 4251 #pragma omp distribute parallel for 4252 for (int i = 0; i < 10; ++i) { 4253 #pragma omp parallel 4254 for (int i = 0; i < 10; ++i) 4255 ; 4256 } 4257 #pragma omp target 4258 #pragma omp teams 4259 #pragma omp distribute parallel for 4260 for (int i = 0; i < 10; ++i) { 4261 #pragma omp sections // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 4262 { 4263 bar(); 4264 } 4265 } 4266 #pragma omp target 4267 #pragma omp teams 4268 #pragma omp distribute parallel for 4269 for (int i = 0; i < 10; ++i) { 4270 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute parallel for region}} 4271 { 4272 bar(); 4273 } 4274 } 4275 #pragma omp target 4276 #pragma omp teams 4277 #pragma omp distribute parallel for 4278 for (int i = 0; i < 10; ++i) { 4279 #pragma omp single // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 4280 { 4281 bar(); 4282 } 4283 } 4284 #pragma omp target 4285 #pragma omp teams 4286 #pragma omp distribute parallel for 4287 for (int i = 0; i < 10; ++i) { 4288 #pragma omp master // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}} 4289 { 4290 bar(); 4291 } 4292 } 4293 #pragma omp target 4294 #pragma omp teams 4295 #pragma omp distribute parallel for 4296 for (int i = 0; i < 10; ++i) { 4297 #pragma omp critical 4298 { 4299 bar(); 4300 } 4301 } 4302 #pragma omp target 4303 #pragma omp teams 4304 #pragma omp distribute parallel for 4305 for (int i = 0; i < 10; ++i) { 4306 #pragma omp parallel 4307 { 4308 #pragma omp single 4309 { 4310 bar(); 4311 } 4312 } 4313 } 4314 #pragma omp target 4315 #pragma omp teams 4316 #pragma omp distribute parallel for 4317 for (int i = 0; i < 10; ++i) { 4318 #pragma omp parallel for 4319 for (int i = 0; i < 10; ++i) 4320 ; 4321 } 4322 #pragma omp target 4323 #pragma omp teams 4324 #pragma omp distribute parallel for 4325 for (int i = 0; i < 10; ++i) { 4326 #pragma omp parallel for simd 4327 for (int i = 0; i < 10; ++i) 4328 ; 4329 } 4330 #pragma omp target 4331 #pragma omp teams 4332 #pragma omp distribute parallel for 4333 for (int i = 0; i < 10; ++i) { 4334 #pragma omp parallel sections 4335 { 4336 bar(); 4337 } 4338 } 4339 #pragma omp target 4340 #pragma omp teams 4341 #pragma omp distribute parallel for 4342 for (int i = 0; i < 10; ++i) { 4343 #pragma omp task 4344 { 4345 bar(); 4346 } 4347 } 4348 #pragma omp target 4349 #pragma omp teams 4350 #pragma omp distribute parallel for 4351 for (int i = 0; i < 10; ++i) { 4352 #pragma omp taskyield 4353 bar(); 4354 } 4355 #pragma omp target 4356 #pragma omp teams 4357 #pragma omp distribute parallel for 4358 for (int i = 0; i < 10; ++i) { 4359 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}} 4360 bar(); 4361 } 4362 #pragma omp target 4363 #pragma omp teams 4364 #pragma omp distribute parallel for 4365 for (int i = 0; i < 10; ++i) { 4366 #pragma omp taskwait 4367 bar(); 4368 } 4369 #pragma omp target 4370 #pragma omp teams 4371 #pragma omp distribute parallel for 4372 for (int i = 0; i < 10; ++i) { 4373 #pragma omp flush 4374 bar(); 4375 } 4376 #pragma omp target 4377 #pragma omp teams 4378 #pragma omp distribute parallel for 4379 for (int i = 0; i < 10; ++i) { 4380 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 4381 bar(); 4382 } 4383 #pragma omp target 4384 #pragma omp teams 4385 #pragma omp distribute parallel for 4386 for (int i = 0; i < 10; ++i) { 4387 #pragma omp atomic 4388 ++a; 4389 } 4390 #pragma omp target 4391 #pragma omp teams 4392 #pragma omp distribute parallel for 4393 for (int i = 0; i < 10; ++i) { 4394 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}} 4395 ++a; 4396 } 4397 #pragma omp target 4398 #pragma omp teams 4399 #pragma omp distribute parallel for 4400 for (int i = 0; i < 10; ++i) { 4401 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}} 4402 ++a; 4403 } 4404 #pragma omp target 4405 #pragma omp teams 4406 #pragma omp distribute parallel for 4407 for (int i = 0; i < 10; ++i) { 4408 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}} 4409 for (int i = 0; i < 10; ++i) 4410 ; 4411 } 4412 #pragma omp target 4413 #pragma omp teams 4414 #pragma omp distribute parallel for 4415 for (int i = 0; i < 10; ++i) { 4416 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}} 4417 ++a; 4418 } 4419 #pragma omp target 4420 #pragma omp teams 4421 #pragma omp distribute parallel for 4422 for (int i = 0; i < 10; ++i) { 4423 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}} 4424 ++a; 4425 } 4426 #pragma omp target 4427 #pragma omp teams 4428 #pragma omp distribute parallel for 4429 for (int i = 0; i < 10; ++i) { 4430 #pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 4431 ++a; 4432 } 4433 #pragma omp target 4434 #pragma omp teams 4435 #pragma omp distribute parallel for 4436 for (int i = 0; i < 10; ++i) { 4437 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}} 4438 ++a; 4439 } 4440 #pragma omp target 4441 #pragma omp teams 4442 #pragma omp distribute parallel for 4443 for (int i = 0; i < 10; ++i) { 4444 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 4445 for (int i = 0; i < 10; ++i) 4446 ; 4447 } 4448 4449 // DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE 4450 #pragma omp target 4451 #pragma omp teams 4452 #pragma omp distribute parallel for simd 4453 for (int i = 0; i < 10; ++i) { 4454 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4455 for (int i = 0; i < 10; ++i) 4456 ; 4457 } 4458 #pragma omp target 4459 #pragma omp teams 4460 #pragma omp distribute parallel for simd 4461 for (int i = 0; i < 10; ++i) { 4462 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4463 for (int i = 0; i < 10; ++i) 4464 ; 4465 } 4466 #pragma omp target 4467 #pragma omp teams 4468 #pragma omp distribute parallel for simd 4469 for (int i = 0; i < 10; ++i) { 4470 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4471 for (int i = 0; i < 10; ++i) 4472 ; 4473 } 4474 #pragma omp target 4475 #pragma omp teams 4476 #pragma omp distribute parallel for simd 4477 for (int i = 0; i < 10; ++i) { 4478 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 4479 for (int i = 0; i < 10; ++i) 4480 ; 4481 } 4482 #pragma omp target 4483 #pragma omp teams 4484 #pragma omp distribute parallel for simd 4485 for (int i = 0; i < 10; ++i) { 4486 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4487 for (int i = 0; i < 10; ++i) 4488 ; 4489 } 4490 #pragma omp target 4491 #pragma omp teams 4492 #pragma omp distribute parallel for simd 4493 for (int i = 0; i < 10; ++i) { 4494 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4495 for (int i = 0; i < 10; ++i) 4496 ; 4497 } 4498 #pragma omp target 4499 #pragma omp teams 4500 #pragma omp distribute parallel for simd 4501 for (int i = 0; i < 10; ++i) { 4502 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4503 { 4504 bar(); 4505 } 4506 } 4507 #pragma omp target 4508 #pragma omp teams 4509 #pragma omp distribute parallel for simd 4510 for (int i = 0; i < 10; ++i) { 4511 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4512 { 4513 bar(); 4514 } 4515 } 4516 #pragma omp target 4517 #pragma omp teams 4518 #pragma omp distribute parallel for simd 4519 for (int i = 0; i < 10; ++i) { 4520 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4521 { 4522 bar(); 4523 } 4524 } 4525 #pragma omp target 4526 #pragma omp teams 4527 #pragma omp distribute parallel for simd 4528 for (int i = 0; i < 10; ++i) { 4529 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4530 { 4531 bar(); 4532 } 4533 } 4534 #pragma omp target 4535 #pragma omp teams 4536 #pragma omp distribute parallel for simd 4537 for (int i = 0; i < 10; ++i) { 4538 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4539 { 4540 bar(); 4541 } 4542 } 4543 #pragma omp target 4544 #pragma omp teams 4545 #pragma omp distribute parallel for simd 4546 for (int i = 0; i < 10; ++i) { 4547 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4548 { 4549 #pragma omp single 4550 { 4551 bar(); 4552 } 4553 } 4554 } 4555 #pragma omp target 4556 #pragma omp teams 4557 #pragma omp distribute parallel for simd 4558 for (int i = 0; i < 10; ++i) { 4559 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4560 for (int i = 0; i < 10; ++i) 4561 ; 4562 } 4563 #pragma omp target 4564 #pragma omp teams 4565 #pragma omp distribute parallel for simd 4566 for (int i = 0; i < 10; ++i) { 4567 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4568 for (int i = 0; i < 10; ++i) 4569 ; 4570 } 4571 #pragma omp target 4572 #pragma omp teams 4573 #pragma omp distribute parallel for simd 4574 for (int i = 0; i < 10; ++i) { 4575 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4576 { 4577 bar(); 4578 } 4579 } 4580 #pragma omp target 4581 #pragma omp teams 4582 #pragma omp distribute parallel for simd 4583 for (int i = 0; i < 10; ++i) { 4584 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4585 { 4586 bar(); 4587 } 4588 } 4589 #pragma omp target 4590 #pragma omp teams 4591 #pragma omp distribute parallel for simd 4592 for (int i = 0; i < 10; ++i) { 4593 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4594 bar(); 4595 } 4596 #pragma omp target 4597 #pragma omp teams 4598 #pragma omp distribute parallel for simd 4599 for (int i = 0; i < 10; ++i) { 4600 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4601 bar(); 4602 } 4603 #pragma omp target 4604 #pragma omp teams 4605 #pragma omp distribute parallel for simd 4606 for (int i = 0; i < 10; ++i) { 4607 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4608 bar(); 4609 } 4610 #pragma omp target 4611 #pragma omp teams 4612 #pragma omp distribute parallel for simd 4613 for (int i = 0; i < 10; ++i) { 4614 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4615 bar(); 4616 } 4617 #pragma omp target 4618 #pragma omp teams 4619 #pragma omp distribute parallel for simd 4620 for (int i = 0; i < 10; ++i) { 4621 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4622 bar(); 4623 } 4624 #pragma omp target 4625 #pragma omp teams 4626 #pragma omp distribute parallel for simd 4627 for (int i = 0; i < 10; ++i) { 4628 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4629 ++a; 4630 } 4631 #pragma omp target 4632 #pragma omp teams 4633 #pragma omp distribute parallel for simd 4634 for (int i = 0; i < 10; ++i) { 4635 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4636 ++a; 4637 } 4638 #pragma omp target 4639 #pragma omp teams 4640 #pragma omp distribute parallel for simd 4641 for (int i = 0; i < 10; ++i) { 4642 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4643 ++a; 4644 } 4645 #pragma omp target 4646 #pragma omp teams 4647 #pragma omp distribute parallel for simd 4648 for (int i = 0; i < 10; ++i) { 4649 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4650 for (int i = 0; i < 10; ++i) 4651 ; 4652 } 4653 #pragma omp target 4654 #pragma omp teams 4655 #pragma omp distribute parallel for simd 4656 for (int i = 0; i < 10; ++i) { 4657 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4658 ++a; 4659 } 4660 #pragma omp target 4661 #pragma omp teams 4662 #pragma omp distribute parallel for simd 4663 for (int i = 0; i < 10; ++i) { 4664 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4665 ++a; 4666 } 4667 #pragma omp target 4668 #pragma omp teams 4669 #pragma omp distribute parallel for simd 4670 for (int i = 0; i < 10; ++i) { 4671 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4672 ++a; 4673 } 4674 #pragma omp target 4675 #pragma omp teams 4676 #pragma omp distribute parallel for simd 4677 for (int i = 0; i < 10; ++i) { 4678 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4679 ++a; 4680 } 4681 #pragma omp target 4682 #pragma omp teams 4683 #pragma omp distribute parallel for simd 4684 for (int i = 0; i < 10; ++i) { 4685 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4686 for (int i = 0; i < 10; ++i) 4687 ++a; 4688 } 4689 } 4690 4691 void foo() { 4692 int a = 0; 4693 // PARALLEL DIRECTIVE 4694 #pragma omp parallel 4695 #pragma omp for 4696 for (int i = 0; i < 10; ++i) 4697 ; 4698 #pragma omp parallel 4699 #pragma omp simd 4700 for (int i = 0; i < 10; ++i) 4701 ; 4702 #pragma omp parallel 4703 #pragma omp for simd 4704 for (int i = 0; i < 10; ++i) 4705 ; 4706 #pragma omp parallel 4707 #pragma omp sections 4708 { 4709 bar(); 4710 } 4711 #pragma omp parallel 4712 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel region}} 4713 { 4714 bar(); 4715 } 4716 #pragma omp parallel 4717 #pragma omp sections 4718 { 4719 bar(); 4720 } 4721 #pragma omp parallel 4722 #pragma omp single 4723 bar(); 4724 #pragma omp parallel 4725 #pragma omp master 4726 bar(); 4727 #pragma omp parallel 4728 #pragma omp critical 4729 bar(); 4730 #pragma omp parallel 4731 #pragma omp parallel for 4732 for (int i = 0; i < 10; ++i) 4733 ; 4734 #pragma omp parallel 4735 #pragma omp parallel for simd 4736 for (int i = 0; i < 10; ++i) 4737 ; 4738 #pragma omp parallel 4739 #pragma omp parallel sections 4740 { 4741 bar(); 4742 } 4743 #pragma omp parallel 4744 #pragma omp task 4745 { 4746 bar(); 4747 } 4748 #pragma omp parallel 4749 { 4750 #pragma omp taskyield 4751 bar(); 4752 } 4753 #pragma omp parallel 4754 { 4755 #pragma omp barrier 4756 bar(); 4757 } 4758 #pragma omp parallel 4759 { 4760 #pragma omp taskwait 4761 bar(); 4762 } 4763 #pragma omp parallel 4764 { 4765 #pragma omp flush 4766 bar(); 4767 } 4768 #pragma omp parallel 4769 { 4770 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 4771 bar(); 4772 } 4773 #pragma omp parallel 4774 { 4775 #pragma omp atomic 4776 ++a; 4777 } 4778 #pragma omp parallel 4779 { 4780 #pragma omp target 4781 ++a; 4782 } 4783 #pragma omp parallel 4784 { 4785 #pragma omp target parallel 4786 ++a; 4787 } 4788 #pragma omp parallel 4789 #pragma omp target parallel for 4790 for (int i = 0; i < 10; ++i) 4791 ; 4792 #pragma omp parallel 4793 { 4794 #pragma omp target enter data map(to: a) 4795 ++a; 4796 } 4797 #pragma omp parallel 4798 { 4799 #pragma omp target exit data map(from: a) 4800 ++a; 4801 } 4802 #pragma omp parallel 4803 { 4804 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 4805 ++a; 4806 } 4807 #pragma omp parallel 4808 { 4809 #pragma omp taskloop 4810 for (int i = 0; i < 10; ++i) 4811 ++a; 4812 } 4813 #pragma omp parallel 4814 { 4815 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 4816 for (int i = 0; i < 10; ++i) 4817 ; 4818 } 4819 #pragma omp parallel 4820 { 4821 #pragma omp target update to(a) 4822 a++; 4823 } 4824 #pragma omp parallel 4825 { 4826 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 4827 for (int i = 0; i < 10; ++i) 4828 ; 4829 } 4830 #pragma omp parallel 4831 { 4832 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 4833 for (int i = 0; i < 10; ++i) 4834 ; 4835 } 4836 #pragma omp parallel 4837 { 4838 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 4839 for (int i = 0; i < 10; ++i) 4840 ; 4841 } 4842 4843 // SIMD DIRECTIVE 4844 #pragma omp simd 4845 for (int i = 0; i < 10; ++i) { 4846 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4847 for (int i = 0; i < 10; ++i) 4848 ; 4849 } 4850 #pragma omp simd 4851 for (int i = 0; i < 10; ++i) { 4852 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 4853 for (int i = 0; i < 10; ++i) 4854 ; 4855 } 4856 #pragma omp simd 4857 for (int i = 0; i < 10; ++i) { 4858 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4859 for (int i = 0; i < 10; ++i) 4860 ; 4861 } 4862 #pragma omp simd 4863 for (int i = 0; i < 10; ++i) { 4864 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4865 for (int i = 0; i < 10; ++i) 4866 ; 4867 } 4868 #pragma omp simd 4869 for (int i = 0; i < 10; ++i) { 4870 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4871 { 4872 bar(); 4873 } 4874 } 4875 #pragma omp simd 4876 for (int i = 0; i < 10; ++i) { 4877 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4878 { 4879 bar(); 4880 } 4881 } 4882 #pragma omp simd 4883 for (int i = 0; i < 10; ++i) { 4884 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4885 bar(); 4886 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4887 bar(); 4888 } 4889 #pragma omp simd 4890 for (int i = 0; i < 10; ++i) { 4891 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4892 bar(); 4893 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4894 bar(); 4895 } 4896 #pragma omp simd 4897 for (int i = 0; i < 10; ++i) { 4898 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4899 for (int i = 0; i < 10; ++i) 4900 ; 4901 } 4902 #pragma omp simd 4903 for (int i = 0; i < 10; ++i) { 4904 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4905 for (int i = 0; i < 10; ++i) 4906 ; 4907 } 4908 #pragma omp simd 4909 for (int i = 0; i < 10; ++i) { 4910 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4911 { 4912 bar(); 4913 } 4914 } 4915 #pragma omp simd 4916 for (int i = 0; i < 10; ++i) { 4917 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4918 { 4919 bar(); 4920 } 4921 } 4922 #pragma omp simd 4923 for (int i = 0; i < 10; ++i) { 4924 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4925 bar(); 4926 } 4927 #pragma omp simd 4928 for (int i = 0; i < 10; ++i) { 4929 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4930 bar(); 4931 } 4932 #pragma omp simd 4933 for (int i = 0; i < 10; ++i) { 4934 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4935 bar(); 4936 } 4937 #pragma omp simd 4938 for (int i = 0; i < 10; ++i) { 4939 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4940 bar(); 4941 } 4942 #pragma omp simd 4943 for (int i = 0; i < 10; ++i) { 4944 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4945 bar(); 4946 } 4947 #pragma omp simd 4948 for (int i = 0; i < 10; ++i) { 4949 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4950 ++a; 4951 } 4952 #pragma omp simd 4953 for (int i = 0; i < 10; ++i) { 4954 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4955 ++a; 4956 } 4957 #pragma omp simd 4958 for (int i = 0; i < 10; ++i) { 4959 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4960 ++a; 4961 } 4962 #pragma omp simd 4963 for (int i = 0; i < 10; ++i) { 4964 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4965 for (int i = 0; i < 10; ++i) 4966 ; 4967 } 4968 #pragma omp simd 4969 for (int i = 0; i < 10; ++i) { 4970 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4971 ++a; 4972 } 4973 #pragma omp simd 4974 for (int i = 0; i < 10; ++i) { 4975 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4976 ++a; 4977 } 4978 #pragma omp simd 4979 for (int i = 0; i < 10; ++i) { 4980 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4981 ++a; 4982 } 4983 #pragma omp simd 4984 for (int i = 0; i < 10; ++i) { 4985 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4986 for (int i = 0; i < 10; ++i) 4987 ++a; 4988 } 4989 #pragma omp simd 4990 for (int i = 0; i < 10; ++i) { 4991 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4992 for (int j = 0; j < 10; ++j) 4993 ; 4994 } 4995 #pragma omp simd 4996 for (int i = 0; i < 10; ++i) { 4997 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 4998 a++; 4999 } 5000 #pragma omp simd 5001 for (int i = 0; i < 10; ++i) { 5002 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5003 for (int j = 0; j < 10; ++j) 5004 ; 5005 } 5006 #pragma omp simd 5007 for (int i = 0; i < 10; ++i) { 5008 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5009 for (int j = 0; j < 10; ++j) 5010 ; 5011 } 5012 #pragma omp simd 5013 for (int i = 0; i < 10; ++i) { 5014 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5015 for (int j = 0; j < 10; ++j) 5016 ; 5017 } 5018 5019 // FOR DIRECTIVE 5020 #pragma omp for 5021 for (int i = 0; i < 10; ++i) { 5022 #pragma omp for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 5023 for (int i = 0; i < 10; ++i) 5024 ; 5025 } 5026 #pragma omp for 5027 for (int i = 0; i < 10; ++i) { 5028 #pragma omp simd 5029 for (int i = 0; i < 10; ++i) 5030 ; 5031 } 5032 #pragma omp for 5033 for (int i = 0; i < 10; ++i) { 5034 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 5035 for (int i = 0; i < 10; ++i) 5036 ; 5037 } 5038 #pragma omp for 5039 for (int i = 0; i < 10; ++i) { 5040 #pragma omp parallel 5041 for (int i = 0; i < 10; ++i) 5042 ; 5043 } 5044 #pragma omp for 5045 for (int i = 0; i < 10; ++i) { 5046 #pragma omp sections // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 5047 { 5048 bar(); 5049 } 5050 } 5051 #pragma omp for 5052 for (int i = 0; i < 10; ++i) { 5053 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a for region}} 5054 { 5055 bar(); 5056 } 5057 } 5058 #pragma omp for 5059 for (int i = 0; i < 10; ++i) { 5060 #pragma omp single // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 5061 bar(); 5062 #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}} 5063 bar(); 5064 #pragma omp critical 5065 bar(); 5066 } 5067 #pragma omp for 5068 for (int i = 0; i < 10; ++i) { 5069 #pragma omp parallel 5070 { 5071 #pragma omp single // OK 5072 { 5073 bar(); 5074 } 5075 #pragma omp for // OK 5076 for (int i = 0; i < 10; ++i) 5077 ; 5078 #pragma omp for simd // OK 5079 for (int i = 0; i < 10; ++i) 5080 ; 5081 #pragma omp sections // OK 5082 { 5083 bar(); 5084 } 5085 } 5086 } 5087 #pragma omp for 5088 for (int i = 0; i < 10; ++i) { 5089 #pragma omp parallel for 5090 for (int i = 0; i < 10; ++i) 5091 ; 5092 } 5093 #pragma omp for 5094 for (int i = 0; i < 10; ++i) { 5095 #pragma omp parallel for simd 5096 for (int i = 0; i < 10; ++i) 5097 ; 5098 } 5099 #pragma omp for 5100 for (int i = 0; i < 10; ++i) { 5101 #pragma omp parallel sections 5102 { 5103 bar(); 5104 } 5105 } 5106 #pragma omp for 5107 for (int i = 0; i < 10; ++i) { 5108 #pragma omp task 5109 { 5110 bar(); 5111 } 5112 } 5113 #pragma omp for 5114 for (int i = 0; i < 10; ++i) { 5115 #pragma omp taskyield 5116 bar(); 5117 } 5118 #pragma omp for 5119 for (int i = 0; i < 10; ++i) { 5120 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}} 5121 bar(); 5122 } 5123 #pragma omp for 5124 for (int i = 0; i < 10; ++i) { 5125 #pragma omp taskwait 5126 bar(); 5127 } 5128 #pragma omp for 5129 for (int i = 0; i < 10; ++i) { 5130 #pragma omp flush 5131 bar(); 5132 } 5133 #pragma omp for 5134 for (int i = 0; i < 10; ++i) { 5135 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 5136 bar(); 5137 } 5138 #pragma omp for ordered 5139 for (int i = 0; i < 10; ++i) { 5140 #pragma omp ordered // OK 5141 bar(); 5142 } 5143 #pragma omp for 5144 for (int i = 0; i < 10; ++i) { 5145 #pragma omp atomic 5146 ++a; 5147 } 5148 #pragma omp for 5149 for (int i = 0; i < 10; ++i) { 5150 #pragma omp target 5151 ++a; 5152 } 5153 #pragma omp for 5154 for (int i = 0; i < 10; ++i) { 5155 #pragma omp target parallel 5156 ++a; 5157 } 5158 #pragma omp for 5159 for (int i = 0; i < 10; ++i) { 5160 #pragma omp target parallel for 5161 for (int i = 0; i < 10; ++i) 5162 ; 5163 } 5164 #pragma omp for 5165 for (int i = 0; i < 10; ++i) { 5166 #pragma omp target enter data map(to: a) 5167 ++a; 5168 } 5169 #pragma omp for 5170 for (int i = 0; i < 10; ++i) { 5171 #pragma omp target exit data map(from: a) 5172 ++a; 5173 } 5174 #pragma omp for 5175 for (int i = 0; i < 10; ++i) { 5176 #pragma omp teams // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 5177 ++a; 5178 } 5179 #pragma omp for 5180 for (int i = 0; i < 10; ++i) { 5181 #pragma omp taskloop 5182 for (int i = 0; i < 10; ++i) 5183 ++a; 5184 } 5185 #pragma omp for 5186 for (int i = 0; i < 10; ++i) { 5187 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 5188 for (int j = 0; j < 10; ++j) 5189 ; 5190 } 5191 #pragma omp for 5192 for (int i = 0; i < 10; ++i) { 5193 #pragma omp target update to(a) 5194 ++a; 5195 } 5196 #pragma omp for 5197 for (int i = 0; i < 10; ++i) { 5198 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 5199 for (int j = 0; j < 10; ++j) 5200 ; 5201 } 5202 #pragma omp for 5203 for (int i = 0; i < 10; ++i) { 5204 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 5205 for (int j = 0; j < 10; ++j) 5206 ; 5207 } 5208 #pragma omp for 5209 for (int i = 0; i < 10; ++i) { 5210 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 5211 for (int j = 0; j < 10; ++j) 5212 ; 5213 } 5214 5215 // FOR SIMD DIRECTIVE 5216 #pragma omp for simd 5217 for (int i = 0; i < 10; ++i) { 5218 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5219 for (int i = 0; i < 10; ++i) 5220 ; 5221 } 5222 #pragma omp for simd 5223 for (int i = 0; i < 10; ++i) { 5224 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 5225 for (int i = 0; i < 10; ++i) 5226 ; 5227 } 5228 #pragma omp for simd 5229 for (int i = 0; i < 10; ++i) { 5230 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5231 for (int i = 0; i < 10; ++i) 5232 ; 5233 } 5234 #pragma omp for simd 5235 for (int i = 0; i < 10; ++i) { 5236 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5237 for (int i = 0; i < 10; ++i) 5238 ; 5239 } 5240 #pragma omp for simd 5241 for (int i = 0; i < 10; ++i) { 5242 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5243 { 5244 bar(); 5245 } 5246 } 5247 #pragma omp for simd 5248 for (int i = 0; i < 10; ++i) { 5249 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5250 { 5251 bar(); 5252 } 5253 } 5254 #pragma omp for simd 5255 for (int i = 0; i < 10; ++i) { 5256 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5257 bar(); 5258 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5259 bar(); 5260 } 5261 #pragma omp for simd 5262 for (int i = 0; i < 10; ++i) { 5263 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5264 bar(); 5265 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5266 bar(); 5267 } 5268 #pragma omp for simd 5269 for (int i = 0; i < 10; ++i) { 5270 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5271 for (int i = 0; i < 10; ++i) 5272 ; 5273 } 5274 #pragma omp for simd 5275 for (int i = 0; i < 10; ++i) { 5276 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5277 for (int i = 0; i < 10; ++i) 5278 ; 5279 } 5280 #pragma omp for simd 5281 for (int i = 0; i < 10; ++i) { 5282 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5283 { 5284 bar(); 5285 } 5286 } 5287 #pragma omp for simd 5288 for (int i = 0; i < 10; ++i) { 5289 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5290 { 5291 bar(); 5292 } 5293 } 5294 #pragma omp for simd 5295 for (int i = 0; i < 10; ++i) { 5296 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5297 bar(); 5298 } 5299 #pragma omp for simd 5300 for (int i = 0; i < 10; ++i) { 5301 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5302 bar(); 5303 } 5304 #pragma omp for simd 5305 for (int i = 0; i < 10; ++i) { 5306 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5307 bar(); 5308 } 5309 #pragma omp for simd 5310 for (int i = 0; i < 10; ++i) { 5311 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5312 bar(); 5313 } 5314 #pragma omp for simd 5315 for (int i = 0; i < 10; ++i) { 5316 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5317 bar(); 5318 } 5319 #pragma omp for simd 5320 for (int i = 0; i < 10; ++i) { 5321 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5322 ++a; 5323 } 5324 #pragma omp for simd 5325 for (int i = 0; i < 10; ++i) { 5326 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5327 ++a; 5328 } 5329 #pragma omp for simd 5330 for (int i = 0; i < 10; ++i) { 5331 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5332 ++a; 5333 } 5334 #pragma omp for simd 5335 for (int i = 0; i < 10; ++i) { 5336 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5337 for (int i = 0; i < 10; ++i) 5338 ; 5339 } 5340 #pragma omp for simd 5341 for (int i = 0; i < 10; ++i) { 5342 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5343 ++a; 5344 } 5345 #pragma omp for simd 5346 for (int i = 0; i < 10; ++i) { 5347 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5348 ++a; 5349 } 5350 #pragma omp for simd 5351 for (int i = 0; i < 10; ++i) { 5352 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5353 ++a; 5354 } 5355 #pragma omp for simd 5356 for (int i = 0; i < 10; ++i) { 5357 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5358 for (int i = 0; i < 10; ++i) 5359 ++a; 5360 } 5361 #pragma omp for simd 5362 for (int i = 0; i < 10; ++i) { 5363 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5364 for (int j = 0; j < 10; ++j) 5365 ; 5366 } 5367 #pragma omp for simd 5368 for (int i = 0; i < 10; ++i) { 5369 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5370 ++a; 5371 } 5372 #pragma omp for simd 5373 for (int i = 0; i < 10; ++i) { 5374 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5375 for (int j = 0; j < 10; ++j) 5376 ; 5377 } 5378 #pragma omp for simd 5379 for (int i = 0; i < 10; ++i) { 5380 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5381 for (int j = 0; j < 10; ++j) 5382 ; 5383 } 5384 #pragma omp for simd 5385 for (int i = 0; i < 10; ++i) { 5386 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 5387 for (int j = 0; j < 10; ++j) 5388 ; 5389 } 5390 5391 // SECTIONS DIRECTIVE 5392 #pragma omp sections 5393 { 5394 #pragma omp for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 5395 for (int i = 0; i < 10; ++i) 5396 ; 5397 } 5398 #pragma omp sections 5399 { 5400 #pragma omp simd 5401 for (int i = 0; i < 10; ++i) 5402 ; 5403 } 5404 #pragma omp sections 5405 { 5406 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 5407 for (int i = 0; i < 10; ++i) 5408 ; 5409 } 5410 #pragma omp sections 5411 { 5412 #pragma omp parallel 5413 for (int i = 0; i < 10; ++i) 5414 ; 5415 } 5416 #pragma omp sections 5417 { 5418 #pragma omp sections // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 5419 { 5420 bar(); 5421 } 5422 } 5423 #pragma omp sections 5424 { 5425 #pragma omp section 5426 { 5427 bar(); 5428 } 5429 } 5430 #pragma omp sections 5431 { 5432 #pragma omp critical 5433 bar(); 5434 #pragma omp single // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 5435 bar(); 5436 #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}} 5437 bar(); 5438 } 5439 #pragma omp sections 5440 { 5441 #pragma omp parallel 5442 { 5443 #pragma omp single // OK 5444 { 5445 bar(); 5446 } 5447 #pragma omp for // OK 5448 for (int i = 0; i < 10; ++i) 5449 ; 5450 #pragma omp for simd // OK 5451 for (int i = 0; i < 10; ++i) 5452 ; 5453 #pragma omp sections // OK 5454 { 5455 bar(); 5456 } 5457 } 5458 } 5459 #pragma omp sections 5460 { 5461 #pragma omp parallel for 5462 for (int i = 0; i < 10; ++i) 5463 ; 5464 } 5465 #pragma omp sections 5466 { 5467 #pragma omp parallel for simd 5468 for (int i = 0; i < 10; ++i) 5469 ; 5470 } 5471 #pragma omp sections 5472 { 5473 #pragma omp parallel sections 5474 { 5475 bar(); 5476 } 5477 } 5478 #pragma omp sections 5479 { 5480 #pragma omp task 5481 { 5482 bar(); 5483 } 5484 } 5485 #pragma omp sections 5486 { 5487 #pragma omp taskyield 5488 } 5489 #pragma omp sections 5490 { 5491 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}} 5492 bar(); 5493 } 5494 #pragma omp sections 5495 { 5496 #pragma omp taskwait 5497 } 5498 #pragma omp sections 5499 { 5500 #pragma omp flush 5501 } 5502 #pragma omp sections 5503 { 5504 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 5505 bar(); 5506 } 5507 #pragma omp sections 5508 { 5509 #pragma omp atomic 5510 ++a; 5511 } 5512 #pragma omp sections 5513 { 5514 #pragma omp target 5515 ++a; 5516 } 5517 #pragma omp sections 5518 { 5519 #pragma omp target parallel 5520 ++a; 5521 } 5522 #pragma omp sections 5523 { 5524 #pragma omp target parallel for 5525 for (int i = 0; i < 10; ++i) 5526 ; 5527 } 5528 #pragma omp sections 5529 { 5530 #pragma omp target enter data map(to: a) 5531 } 5532 #pragma omp sections 5533 { 5534 #pragma omp target exit data map(from: a) 5535 } 5536 #pragma omp sections 5537 { 5538 #pragma omp teams // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 5539 ++a; 5540 } 5541 #pragma omp sections 5542 { 5543 #pragma omp taskloop 5544 for (int i = 0; i < 10; ++i) 5545 ++a; 5546 } 5547 #pragma omp sections 5548 { 5549 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 5550 for (int i = 0; i < 10; ++i) 5551 ; 5552 } 5553 #pragma omp sections 5554 { 5555 #pragma omp target update to(a) 5556 } 5557 #pragma omp sections 5558 { 5559 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 5560 for (int i = 0; i < 10; ++i) 5561 ; 5562 } 5563 #pragma omp sections 5564 { 5565 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 5566 for (int i = 0; i < 10; ++i) 5567 ; 5568 } 5569 #pragma omp sections 5570 { 5571 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 5572 for (int i = 0; i < 10; ++i) 5573 ; 5574 } 5575 5576 // SECTION DIRECTIVE 5577 #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}} 5578 { 5579 bar(); 5580 } 5581 #pragma omp sections 5582 { 5583 #pragma omp section 5584 { 5585 #pragma omp for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 5586 for (int i = 0; i < 10; ++i) 5587 ; 5588 } 5589 } 5590 #pragma omp sections 5591 { 5592 #pragma omp section 5593 { 5594 #pragma omp simd 5595 for (int i = 0; i < 10; ++i) 5596 ; 5597 } 5598 } 5599 #pragma omp sections 5600 { 5601 #pragma omp section 5602 { 5603 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 5604 for (int i = 0; i < 10; ++i) 5605 ; 5606 } 5607 } 5608 #pragma omp sections 5609 { 5610 #pragma omp section 5611 { 5612 #pragma omp parallel 5613 for (int i = 0; i < 10; ++i) 5614 ; 5615 } 5616 } 5617 #pragma omp sections 5618 { 5619 #pragma omp section 5620 { 5621 #pragma omp sections // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 5622 { 5623 bar(); 5624 } 5625 } 5626 } 5627 #pragma omp sections 5628 { 5629 #pragma omp section 5630 { 5631 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a section region}} 5632 { 5633 bar(); 5634 } 5635 } 5636 } 5637 #pragma omp sections 5638 { 5639 #pragma omp section 5640 { 5641 #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 5642 bar(); 5643 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}} 5644 bar(); 5645 #pragma omp critical 5646 bar(); 5647 } 5648 } 5649 #pragma omp sections 5650 { 5651 #pragma omp section 5652 { 5653 #pragma omp parallel 5654 { 5655 #pragma omp single // OK 5656 { 5657 bar(); 5658 } 5659 #pragma omp for // OK 5660 for (int i = 0; i < 10; ++i) 5661 ; 5662 #pragma omp for simd // OK 5663 for (int i = 0; i < 10; ++i) 5664 ; 5665 #pragma omp sections // OK 5666 { 5667 bar(); 5668 } 5669 } 5670 } 5671 } 5672 #pragma omp sections 5673 { 5674 #pragma omp section 5675 { 5676 #pragma omp parallel for 5677 for (int i = 0; i < 10; ++i) 5678 ; 5679 } 5680 } 5681 #pragma omp sections 5682 { 5683 #pragma omp section 5684 { 5685 #pragma omp parallel for simd 5686 for (int i = 0; i < 10; ++i) 5687 ; 5688 } 5689 } 5690 #pragma omp sections 5691 { 5692 #pragma omp section 5693 { 5694 #pragma omp parallel sections 5695 { 5696 bar(); 5697 } 5698 } 5699 } 5700 #pragma omp sections 5701 { 5702 #pragma omp section 5703 { 5704 #pragma omp task 5705 { 5706 bar(); 5707 } 5708 } 5709 } 5710 #pragma omp sections 5711 { 5712 #pragma omp section 5713 { 5714 #pragma omp taskyield 5715 bar(); 5716 } 5717 } 5718 #pragma omp sections 5719 { 5720 #pragma omp section 5721 { 5722 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'section' region}} 5723 bar(); 5724 } 5725 } 5726 #pragma omp sections 5727 { 5728 #pragma omp section 5729 { 5730 #pragma omp taskwait 5731 bar(); 5732 } 5733 } 5734 #pragma omp sections 5735 { 5736 #pragma omp section 5737 { 5738 #pragma omp flush 5739 bar(); 5740 } 5741 } 5742 #pragma omp sections 5743 { 5744 #pragma omp section 5745 { 5746 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 5747 bar(); 5748 } 5749 } 5750 #pragma omp sections 5751 { 5752 #pragma omp section 5753 { 5754 #pragma omp atomic 5755 ++a; 5756 } 5757 } 5758 #pragma omp sections 5759 { 5760 #pragma omp section 5761 { 5762 #pragma omp target 5763 ++a; 5764 } 5765 } 5766 #pragma omp sections 5767 { 5768 #pragma omp section 5769 { 5770 #pragma omp target parallel 5771 ++a; 5772 } 5773 } 5774 #pragma omp sections 5775 { 5776 #pragma omp section 5777 { 5778 #pragma omp target parallel for 5779 for (int i = 0; i < 10; ++i) 5780 ; 5781 } 5782 } 5783 #pragma omp sections 5784 { 5785 #pragma omp section 5786 { 5787 #pragma omp target enter data map(to: a) 5788 ++a; 5789 } 5790 } 5791 #pragma omp sections 5792 { 5793 #pragma omp section 5794 { 5795 #pragma omp target exit data map(from: a) 5796 ++a; 5797 } 5798 } 5799 #pragma omp sections 5800 { 5801 #pragma omp section 5802 { 5803 #pragma omp teams // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 5804 ++a; 5805 } 5806 } 5807 #pragma omp sections 5808 { 5809 #pragma omp section 5810 { 5811 #pragma omp taskloop 5812 for (int i = 0; i < 10; ++i) 5813 ++a; 5814 } 5815 } 5816 #pragma omp sections 5817 { 5818 #pragma omp section 5819 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 5820 for (int i = 0; i < 10; ++i) 5821 ; 5822 } 5823 #pragma omp sections 5824 { 5825 #pragma omp section 5826 { 5827 #pragma omp target update to(a) 5828 a++; 5829 } 5830 } 5831 #pragma omp sections 5832 { 5833 #pragma omp section 5834 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 5835 for (int i = 0; i < 10; ++i) 5836 ; 5837 } 5838 #pragma omp sections 5839 { 5840 #pragma omp section 5841 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 5842 for (int i = 0; i < 10; ++i) 5843 ; 5844 } 5845 #pragma omp sections 5846 { 5847 #pragma omp section 5848 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 5849 for (int i = 0; i < 10; ++i) 5850 ; 5851 } 5852 5853 // SINGLE DIRECTIVE 5854 #pragma omp single 5855 { 5856 #pragma omp for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 5857 for (int i = 0; i < 10; ++i) 5858 ; 5859 } 5860 #pragma omp single 5861 { 5862 #pragma omp simd 5863 for (int i = 0; i < 10; ++i) 5864 ; 5865 } 5866 #pragma omp single 5867 { 5868 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 5869 for (int i = 0; i < 10; ++i) 5870 ; 5871 } 5872 #pragma omp single 5873 { 5874 #pragma omp parallel 5875 for (int i = 0; i < 10; ++i) 5876 ; 5877 } 5878 #pragma omp single 5879 { 5880 #pragma omp single // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 5881 { 5882 bar(); 5883 } 5884 #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}} 5885 bar(); 5886 #pragma omp critical 5887 bar(); 5888 } 5889 #pragma omp single 5890 { 5891 #pragma omp sections // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 5892 { 5893 bar(); 5894 } 5895 } 5896 #pragma omp single 5897 { 5898 #pragma omp parallel 5899 { 5900 #pragma omp single // OK 5901 { 5902 bar(); 5903 } 5904 #pragma omp for // OK 5905 for (int i = 0; i < 10; ++i) 5906 ; 5907 #pragma omp for simd // OK 5908 for (int i = 0; i < 10; ++i) 5909 ; 5910 #pragma omp sections // OK 5911 { 5912 bar(); 5913 } 5914 } 5915 } 5916 #pragma omp single 5917 { 5918 #pragma omp parallel for 5919 for (int i = 0; i < 10; ++i) 5920 ; 5921 } 5922 #pragma omp single 5923 { 5924 #pragma omp parallel for simd 5925 for (int i = 0; i < 10; ++i) 5926 ; 5927 } 5928 #pragma omp single 5929 { 5930 #pragma omp parallel sections 5931 { 5932 bar(); 5933 } 5934 } 5935 #pragma omp single 5936 { 5937 #pragma omp task 5938 { 5939 bar(); 5940 } 5941 } 5942 #pragma omp single 5943 { 5944 #pragma omp taskyield 5945 bar(); 5946 } 5947 #pragma omp single 5948 { 5949 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}} 5950 bar(); 5951 } 5952 #pragma omp single 5953 { 5954 #pragma omp taskwait 5955 bar(); 5956 } 5957 #pragma omp single 5958 { 5959 #pragma omp flush 5960 bar(); 5961 } 5962 #pragma omp single 5963 { 5964 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 5965 bar(); 5966 } 5967 #pragma omp single 5968 { 5969 #pragma omp atomic 5970 ++a; 5971 } 5972 #pragma omp single 5973 { 5974 #pragma omp target 5975 ++a; 5976 } 5977 #pragma omp single 5978 { 5979 #pragma omp target parallel 5980 ++a; 5981 } 5982 #pragma omp single 5983 { 5984 #pragma omp target parallel for 5985 for (int i = 0; i < 10; ++i) 5986 ; 5987 } 5988 #pragma omp single 5989 { 5990 #pragma omp target enter data map(to: a) 5991 ++a; 5992 } 5993 #pragma omp single 5994 { 5995 #pragma omp target exit data map(from: a) 5996 ++a; 5997 } 5998 #pragma omp single 5999 { 6000 #pragma omp teams // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 6001 ++a; 6002 } 6003 #pragma omp single 6004 { 6005 #pragma omp taskloop 6006 for (int i = 0; i < 10; ++i) 6007 ++a; 6008 } 6009 #pragma omp single 6010 { 6011 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 6012 for (int i = 0; i < 10; ++i) 6013 ; 6014 } 6015 #pragma omp single 6016 { 6017 #pragma omp target update to(a) 6018 a++; 6019 } 6020 #pragma omp single 6021 { 6022 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 6023 for (int i = 0; i < 10; ++i) 6024 ; 6025 } 6026 #pragma omp single 6027 { 6028 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 6029 for (int i = 0; i < 10; ++i) 6030 ; 6031 } 6032 #pragma omp single 6033 { 6034 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 6035 for (int i = 0; i < 10; ++i) 6036 ; 6037 } 6038 6039 // MASTER DIRECTIVE 6040 #pragma omp master 6041 { 6042 #pragma omp for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 6043 for (int i = 0; i < 10; ++i) 6044 ; 6045 } 6046 #pragma omp master 6047 { 6048 #pragma omp simd 6049 for (int i = 0; i < 10; ++i) 6050 ; 6051 } 6052 #pragma omp master 6053 { 6054 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 6055 for (int i = 0; i < 10; ++i) 6056 ; 6057 } 6058 #pragma omp master 6059 { 6060 #pragma omp parallel 6061 for (int i = 0; i < 10; ++i) 6062 ; 6063 } 6064 #pragma omp master 6065 { 6066 #pragma omp single // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 6067 { 6068 bar(); 6069 } 6070 } 6071 #pragma omp master 6072 { 6073 #pragma omp master // OK, though second 'master' is redundant 6074 { 6075 bar(); 6076 } 6077 } 6078 #pragma omp master 6079 { 6080 #pragma omp critical 6081 { 6082 bar(); 6083 } 6084 } 6085 #pragma omp master 6086 { 6087 #pragma omp sections // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 6088 { 6089 bar(); 6090 } 6091 } 6092 #pragma omp master 6093 { 6094 #pragma omp parallel 6095 { 6096 #pragma omp master // OK 6097 { 6098 bar(); 6099 } 6100 #pragma omp for // OK 6101 for (int i = 0; i < 10; ++i) 6102 ; 6103 #pragma omp for simd // OK 6104 for (int i = 0; i < 10; ++i) 6105 ; 6106 #pragma omp sections // OK 6107 { 6108 bar(); 6109 } 6110 } 6111 } 6112 #pragma omp master 6113 { 6114 #pragma omp parallel for 6115 for (int i = 0; i < 10; ++i) 6116 ; 6117 } 6118 #pragma omp master 6119 { 6120 #pragma omp parallel for simd 6121 for (int i = 0; i < 10; ++i) 6122 ; 6123 } 6124 #pragma omp master 6125 { 6126 #pragma omp parallel sections 6127 { 6128 bar(); 6129 } 6130 } 6131 #pragma omp master 6132 { 6133 #pragma omp task 6134 { 6135 bar(); 6136 } 6137 } 6138 #pragma omp master 6139 { 6140 #pragma omp taskyield 6141 bar(); 6142 } 6143 #pragma omp master 6144 { 6145 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}} 6146 bar(); 6147 } 6148 #pragma omp master 6149 { 6150 #pragma omp taskwait 6151 bar(); 6152 } 6153 #pragma omp master 6154 { 6155 #pragma omp flush 6156 bar(); 6157 } 6158 #pragma omp master 6159 { 6160 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 6161 bar(); 6162 } 6163 #pragma omp master 6164 { 6165 #pragma omp atomic 6166 ++a; 6167 } 6168 #pragma omp master 6169 { 6170 #pragma omp target 6171 ++a; 6172 } 6173 #pragma omp master 6174 { 6175 #pragma omp target parallel 6176 ++a; 6177 } 6178 #pragma omp master 6179 { 6180 #pragma omp target parallel for 6181 for (int i = 0; i < 10; ++i) 6182 ; 6183 } 6184 #pragma omp master 6185 { 6186 #pragma omp target enter data map(to: a) 6187 ++a; 6188 } 6189 #pragma omp master 6190 { 6191 #pragma omp target exit data map(from: a) 6192 ++a; 6193 } 6194 #pragma omp master 6195 { 6196 #pragma omp teams // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 6197 ++a; 6198 } 6199 #pragma omp master 6200 { 6201 #pragma omp taskloop 6202 for (int i = 0; i < 10; ++i) 6203 ++a; 6204 } 6205 #pragma omp master 6206 { 6207 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 6208 for (int i = 0; i < 10; ++i) 6209 ; 6210 } 6211 #pragma omp master 6212 { 6213 #pragma omp target update to(a) 6214 ++a; 6215 } 6216 #pragma omp master 6217 { 6218 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 6219 for (int i = 0; i < 10; ++i) 6220 ; 6221 } 6222 #pragma omp master 6223 { 6224 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 6225 for (int i = 0; i < 10; ++i) 6226 ; 6227 } 6228 #pragma omp master 6229 { 6230 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 6231 for (int i = 0; i < 10; ++i) 6232 ; 6233 } 6234 6235 // CRITICAL DIRECTIVE 6236 #pragma omp critical 6237 { 6238 #pragma omp for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 6239 for (int i = 0; i < 10; ++i) 6240 ; 6241 } 6242 #pragma omp critical 6243 { 6244 #pragma omp simd 6245 for (int i = 0; i < 10; ++i) 6246 ; 6247 } 6248 #pragma omp critical 6249 { 6250 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 6251 for (int i = 0; i < 10; ++i) 6252 ; 6253 } 6254 #pragma omp critical 6255 { 6256 #pragma omp parallel 6257 for (int i = 0; i < 10; ++i) 6258 ; 6259 } 6260 #pragma omp critical 6261 { 6262 #pragma omp single // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 6263 { 6264 bar(); 6265 } 6266 } 6267 #pragma omp critical 6268 { 6269 #pragma omp master // OK, though second 'master' is redundant 6270 { 6271 bar(); 6272 } 6273 } 6274 #pragma omp critical 6275 { 6276 #pragma omp critical 6277 { 6278 bar(); 6279 } 6280 } 6281 #pragma omp critical 6282 { 6283 #pragma omp sections // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 6284 { 6285 bar(); 6286 } 6287 } 6288 #pragma omp critical 6289 { 6290 #pragma omp parallel 6291 { 6292 #pragma omp master // OK 6293 { 6294 bar(); 6295 } 6296 #pragma omp for // OK 6297 for (int i = 0; i < 10; ++i) 6298 ; 6299 #pragma omp for simd // OK 6300 for (int i = 0; i < 10; ++i) 6301 ; 6302 #pragma omp sections // OK 6303 { 6304 bar(); 6305 } 6306 } 6307 } 6308 #pragma omp critical 6309 { 6310 #pragma omp parallel for 6311 for (int i = 0; i < 10; ++i) 6312 ; 6313 } 6314 #pragma omp critical 6315 { 6316 #pragma omp parallel for simd 6317 for (int i = 0; i < 10; ++i) 6318 ; 6319 } 6320 #pragma omp critical 6321 { 6322 #pragma omp parallel sections 6323 { 6324 bar(); 6325 } 6326 } 6327 #pragma omp critical 6328 { 6329 #pragma omp task 6330 { 6331 bar(); 6332 } 6333 } 6334 #pragma omp critical 6335 { 6336 #pragma omp taskyield 6337 bar(); 6338 } 6339 #pragma omp critical 6340 { 6341 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'critical' region}} 6342 bar(); 6343 } 6344 #pragma omp critical 6345 { 6346 #pragma omp taskwait 6347 bar(); 6348 } 6349 #pragma omp critical(Belka) 6350 { 6351 #pragma omp critical(Strelka) 6352 bar(); 6353 } 6354 #pragma omp critical(Tuzik) // expected-note {{previous 'critical' region starts here}} 6355 { 6356 #pragma omp critical(grelka) // expected-note {{previous 'critical' region starts here}} 6357 { 6358 #pragma omp critical(Tuzik) // expected-error {{cannot nest 'critical' regions having the same name 'Tuzik'}} 6359 { 6360 #pragma omp parallel 6361 #pragma omp critical(grelka) // expected-error {{cannot nest 'critical' regions having the same name 'grelka'}} 6362 { 6363 bar(); 6364 } 6365 } 6366 } 6367 } 6368 #pragma omp critical 6369 { 6370 #pragma omp flush 6371 bar(); 6372 } 6373 #pragma omp critical 6374 { 6375 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 6376 bar(); 6377 } 6378 #pragma omp critical 6379 { 6380 #pragma omp atomic 6381 ++a; 6382 } 6383 #pragma omp critical 6384 { 6385 #pragma omp target 6386 ++a; 6387 } 6388 #pragma omp critical 6389 { 6390 #pragma omp target parallel 6391 ++a; 6392 } 6393 #pragma omp critical 6394 { 6395 #pragma omp target parallel for 6396 for (int i = 0; i < 10; ++i) 6397 ; 6398 } 6399 #pragma omp critical 6400 { 6401 #pragma omp target enter data map(to: a) 6402 ++a; 6403 } 6404 #pragma omp critical 6405 { 6406 #pragma omp target exit data map(from: a) 6407 ++a; 6408 } 6409 #pragma omp critical 6410 { 6411 #pragma omp teams // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 6412 ++a; 6413 } 6414 #pragma omp critical 6415 { 6416 #pragma omp taskloop 6417 for (int i = 0; i < 10; ++i) 6418 ++a; 6419 } 6420 #pragma omp critical 6421 { 6422 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 6423 for (int i = 0; i < 10; ++i) 6424 ; 6425 } 6426 #pragma omp critical 6427 { 6428 #pragma omp target update to(a) 6429 a++; 6430 } 6431 #pragma omp critical 6432 { 6433 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 6434 for (int i = 0; i < 10; ++i) 6435 ; 6436 } 6437 #pragma omp critical 6438 { 6439 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 6440 for (int i = 0; i < 10; ++i) 6441 ; 6442 } 6443 #pragma omp critical 6444 { 6445 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 6446 for (int i = 0; i < 10; ++i) 6447 ; 6448 } 6449 6450 // PARALLEL FOR DIRECTIVE 6451 #pragma omp parallel for 6452 for (int i = 0; i < 10; ++i) { 6453 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 6454 for (int i = 0; i < 10; ++i) 6455 ; 6456 } 6457 #pragma omp parallel for 6458 for (int i = 0; i < 10; ++i) { 6459 #pragma omp simd 6460 for (int i = 0; i < 10; ++i) 6461 ; 6462 } 6463 #pragma omp parallel for 6464 for (int i = 0; i < 10; ++i) { 6465 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 6466 for (int i = 0; i < 10; ++i) 6467 ; 6468 } 6469 6470 #pragma omp parallel for 6471 for (int i = 0; i < 10; ++i) { 6472 #pragma omp parallel 6473 for (int i = 0; i < 10; ++i) 6474 ; 6475 } 6476 #pragma omp parallel for 6477 for (int i = 0; i < 10; ++i) { 6478 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 6479 { 6480 bar(); 6481 } 6482 } 6483 #pragma omp parallel for 6484 for (int i = 0; i < 10; ++i) { 6485 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel for region}} 6486 { 6487 bar(); 6488 } 6489 } 6490 #pragma omp parallel for 6491 for (int i = 0; i < 10; ++i) { 6492 #pragma omp single // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 6493 { 6494 bar(); 6495 } 6496 #pragma omp master // expected-error {{region cannot be closely nested inside 'parallel for' region}} 6497 { 6498 bar(); 6499 } 6500 #pragma omp critical 6501 { 6502 bar(); 6503 } 6504 } 6505 #pragma omp parallel for 6506 for (int i = 0; i < 10; ++i) { 6507 #pragma omp parallel 6508 { 6509 #pragma omp single // OK 6510 { 6511 bar(); 6512 } 6513 #pragma omp master // OK 6514 { 6515 bar(); 6516 } 6517 #pragma omp critical // OK 6518 { 6519 bar(); 6520 } 6521 #pragma omp for // OK 6522 for (int i = 0; i < 10; ++i) 6523 ; 6524 #pragma omp for simd // OK 6525 for (int i = 0; i < 10; ++i) 6526 ; 6527 #pragma omp sections // OK 6528 { 6529 bar(); 6530 } 6531 } 6532 } 6533 #pragma omp parallel for 6534 for (int i = 0; i < 10; ++i) { 6535 #pragma omp parallel for 6536 for (int i = 0; i < 10; ++i) 6537 ; 6538 } 6539 #pragma omp parallel for 6540 for (int i = 0; i < 10; ++i) { 6541 #pragma omp parallel for simd 6542 for (int i = 0; i < 10; ++i) 6543 ; 6544 } 6545 #pragma omp parallel for 6546 for (int i = 0; i < 10; ++i) { 6547 #pragma omp parallel sections 6548 { 6549 bar(); 6550 } 6551 } 6552 #pragma omp parallel for 6553 for (int i = 0; i < 10; ++i) { 6554 #pragma omp task 6555 { 6556 bar(); 6557 } 6558 } 6559 #pragma omp parallel for 6560 for (int i = 0; i < 10; ++i) { 6561 #pragma omp taskyield 6562 bar(); 6563 } 6564 #pragma omp parallel for 6565 for (int i = 0; i < 10; ++i) { 6566 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}} 6567 bar(); 6568 } 6569 #pragma omp parallel for 6570 for (int i = 0; i < 10; ++i) { 6571 #pragma omp taskwait 6572 bar(); 6573 } 6574 #pragma omp parallel for 6575 for (int i = 0; i < 10; ++i) { 6576 #pragma omp flush 6577 bar(); 6578 } 6579 #pragma omp parallel for 6580 for (int i = 0; i < 10; ++i) { 6581 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 6582 bar(); 6583 } 6584 #pragma omp parallel for ordered 6585 for (int i = 0; i < 10; ++i) { 6586 #pragma omp ordered // OK 6587 bar(); 6588 } 6589 #pragma omp parallel for 6590 for (int i = 0; i < 10; ++i) { 6591 #pragma omp atomic 6592 ++a; 6593 } 6594 #pragma omp parallel for 6595 for (int i = 0; i < 10; ++i) { 6596 #pragma omp target 6597 ++a; 6598 } 6599 #pragma omp parallel for 6600 for (int i = 0; i < 10; ++i) { 6601 #pragma omp target parallel 6602 ++a; 6603 } 6604 #pragma omp parallel for 6605 for (int i = 0; i < 10; ++i) { 6606 #pragma omp target parallel for 6607 for (int i = 0; i < 10; ++i) 6608 ; 6609 } 6610 #pragma omp parallel for 6611 for (int i = 0; i < 10; ++i) { 6612 #pragma omp target enter data map(to: a) 6613 ++a; 6614 } 6615 #pragma omp parallel for 6616 for (int i = 0; i < 10; ++i) { 6617 #pragma omp target exit data map(from: a) 6618 ++a; 6619 } 6620 #pragma omp parallel for 6621 for (int i = 0; i < 10; ++i) { 6622 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 6623 ++a; 6624 } 6625 #pragma omp parallel for 6626 for (int i = 0; i < 10; ++i) { 6627 #pragma omp taskloop 6628 for (int i = 0; i < 10; ++i) 6629 ++a; 6630 } 6631 #pragma omp parallel for 6632 for (int i = 0; i < 10; ++i) { 6633 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 6634 for (int j = 0; j < 10; ++j) 6635 ; 6636 } 6637 #pragma omp parallel for 6638 for (int i = 0; i < 10; ++i) { 6639 #pragma omp target update to(a) 6640 a++; 6641 } 6642 #pragma omp parallel for 6643 for (int i = 0; i < 10; ++i) { 6644 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 6645 for (int j = 0; j < 10; ++j) 6646 ; 6647 } 6648 #pragma omp parallel for 6649 for (int i = 0; i < 10; ++i) { 6650 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 6651 for (int j = 0; j < 10; ++j) 6652 ; 6653 } 6654 #pragma omp parallel for 6655 for (int i = 0; i < 10; ++i) { 6656 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 6657 for (int j = 0; j < 10; ++j) 6658 ; 6659 } 6660 6661 // PARALLEL FOR SIMD DIRECTIVE 6662 #pragma omp parallel for simd 6663 for (int i = 0; i < 10; ++i) { 6664 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6665 for (int i = 0; i < 10; ++i) 6666 ; 6667 } 6668 #pragma omp parallel for simd 6669 for (int i = 0; i < 10; ++i) { 6670 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 6671 for (int i = 0; i < 10; ++i) 6672 ; 6673 } 6674 #pragma omp parallel for simd 6675 for (int i = 0; i < 10; ++i) { 6676 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6677 for (int i = 0; i < 10; ++i) 6678 ; 6679 } 6680 #pragma omp parallel for simd 6681 for (int i = 0; i < 10; ++i) { 6682 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6683 for (int i = 0; i < 10; ++i) 6684 ; 6685 } 6686 #pragma omp parallel for simd 6687 for (int i = 0; i < 10; ++i) { 6688 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6689 { 6690 bar(); 6691 } 6692 } 6693 #pragma omp parallel for simd 6694 for (int i = 0; i < 10; ++i) { 6695 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6696 { 6697 bar(); 6698 } 6699 } 6700 #pragma omp parallel for simd 6701 for (int i = 0; i < 10; ++i) { 6702 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6703 { 6704 bar(); 6705 } 6706 } 6707 6708 #pragma omp parallel for simd 6709 for (int i = 0; i < 10; ++i) { 6710 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6711 { 6712 bar(); 6713 } 6714 } 6715 6716 #pragma omp parallel for simd 6717 for (int i = 0; i < 10; ++i) { 6718 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6719 { 6720 bar(); 6721 } 6722 } 6723 6724 #pragma omp parallel for simd 6725 for (int i = 0; i < 10; ++i) { 6726 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6727 { 6728 #pragma omp single 6729 { 6730 bar(); 6731 } 6732 #pragma omp for 6733 for (int i = 0; i < 10; ++i) 6734 ; 6735 #pragma omp for simd 6736 for (int i = 0; i < 10; ++i) 6737 ; 6738 #pragma omp sections 6739 { 6740 bar(); 6741 } 6742 } 6743 } 6744 #pragma omp parallel for simd 6745 for (int i = 0; i < 10; ++i) { 6746 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6747 for (int i = 0; i < 10; ++i) 6748 ; 6749 } 6750 #pragma omp parallel for simd 6751 for (int i = 0; i < 10; ++i) { 6752 #pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}} 6753 for (int i = 0; i < 10; ++i) 6754 ; 6755 } 6756 #pragma omp parallel for simd 6757 for (int i = 0; i < 10; ++i) { 6758 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6759 { 6760 bar(); 6761 } 6762 } 6763 #pragma omp parallel for simd 6764 for (int i = 0; i < 10; ++i) { 6765 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6766 { 6767 bar(); 6768 } 6769 } 6770 #pragma omp parallel for simd 6771 for (int i = 0; i < 10; ++i) { 6772 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6773 bar(); 6774 } 6775 #pragma omp parallel for simd 6776 for (int i = 0; i < 10; ++i) { 6777 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6778 bar(); 6779 } 6780 #pragma omp parallel for simd 6781 for (int i = 0; i < 10; ++i) { 6782 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6783 bar(); 6784 } 6785 #pragma omp parallel for simd 6786 for (int i = 0; i < 10; ++i) { 6787 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6788 bar(); 6789 } 6790 #pragma omp parallel for simd 6791 for (int i = 0; i < 10; ++i) { 6792 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6793 bar(); 6794 } 6795 #pragma omp parallel for simd 6796 for (int i = 0; i < 10; ++i) { 6797 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6798 bar(); 6799 } 6800 #pragma omp parallel for simd 6801 for (int i = 0; i < 10; ++i) { 6802 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6803 ++a; 6804 } 6805 #pragma omp parallel for simd 6806 for (int i = 0; i < 10; ++i) { 6807 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6808 ++a; 6809 } 6810 #pragma omp parallel for simd 6811 for (int i = 0; i < 10; ++i) { 6812 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6813 ++a; 6814 } 6815 #pragma omp parallel for simd 6816 for (int i = 0; i < 10; ++i) { 6817 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6818 for (int i = 0; i < 10; ++i) 6819 ; 6820 } 6821 #pragma omp parallel for simd 6822 for (int i = 0; i < 10; ++i) { 6823 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6824 ++a; 6825 } 6826 #pragma omp parallel for simd 6827 for (int i = 0; i < 10; ++i) { 6828 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6829 ++a; 6830 } 6831 #pragma omp parallel for simd 6832 for (int i = 0; i < 10; ++i) { 6833 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6834 ++a; 6835 } 6836 #pragma omp parallel for simd 6837 for (int i = 0; i < 10; ++i) { 6838 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6839 for (int i = 0; i < 10; ++i) 6840 ++a; 6841 } 6842 #pragma omp parallel for simd 6843 for (int i = 0; i < 10; ++i) { 6844 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6845 for (int j = 0; j < 10; ++j) 6846 ; 6847 } 6848 #pragma omp parallel for simd 6849 for (int i = 0; i < 10; ++i) { 6850 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6851 a++; 6852 } 6853 #pragma omp parallel for simd 6854 for (int i = 0; i < 10; ++i) { 6855 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6856 for (int j = 0; j < 10; ++j) 6857 ; 6858 } 6859 #pragma omp parallel for simd 6860 for (int i = 0; i < 10; ++i) { 6861 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6862 for (int j = 0; j < 10; ++j) 6863 ; 6864 } 6865 #pragma omp parallel for simd 6866 for (int i = 0; i < 10; ++i) { 6867 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 6868 for (int j = 0; j < 10; ++j) 6869 ; 6870 } 6871 6872 // PARALLEL SECTIONS DIRECTIVE 6873 #pragma omp parallel sections 6874 { 6875 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 6876 for (int i = 0; i < 10; ++i) 6877 ; 6878 } 6879 #pragma omp parallel sections 6880 { 6881 #pragma omp simd 6882 for (int i = 0; i < 10; ++i) 6883 ; 6884 } 6885 #pragma omp parallel sections 6886 { 6887 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 6888 for (int i = 0; i < 10; ++i) 6889 ; 6890 } 6891 #pragma omp parallel sections 6892 { 6893 #pragma omp parallel 6894 for (int i = 0; i < 10; ++i) 6895 ; 6896 } 6897 #pragma omp parallel sections 6898 { 6899 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 6900 { 6901 bar(); 6902 } 6903 } 6904 #pragma omp parallel sections 6905 { 6906 #pragma omp section 6907 { 6908 bar(); 6909 } 6910 } 6911 #pragma omp parallel sections 6912 { 6913 #pragma omp section 6914 { 6915 #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 6916 bar(); 6917 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}} 6918 bar(); 6919 #pragma omp critical 6920 bar(); 6921 } 6922 } 6923 #pragma omp parallel sections 6924 { 6925 #pragma omp parallel 6926 { 6927 #pragma omp single // OK 6928 { 6929 bar(); 6930 } 6931 #pragma omp master // OK 6932 { 6933 bar(); 6934 } 6935 #pragma omp critical // OK 6936 { 6937 bar(); 6938 } 6939 #pragma omp for // OK 6940 for (int i = 0; i < 10; ++i) 6941 ; 6942 #pragma omp for simd // OK 6943 for (int i = 0; i < 10; ++i) 6944 ; 6945 #pragma omp sections // OK 6946 { 6947 bar(); 6948 } 6949 } 6950 } 6951 #pragma omp parallel sections 6952 { 6953 #pragma omp parallel for 6954 for (int i = 0; i < 10; ++i) 6955 ; 6956 } 6957 #pragma omp parallel sections 6958 { 6959 #pragma omp parallel for simd 6960 for (int i = 0; i < 10; ++i) 6961 ; 6962 } 6963 #pragma omp parallel sections 6964 { 6965 #pragma omp parallel sections 6966 { 6967 bar(); 6968 } 6969 } 6970 #pragma omp parallel sections 6971 { 6972 #pragma omp task 6973 { 6974 bar(); 6975 } 6976 } 6977 #pragma omp parallel sections 6978 { 6979 #pragma omp taskyield 6980 } 6981 #pragma omp parallel sections 6982 { 6983 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}} 6984 } 6985 #pragma omp parallel sections 6986 { 6987 #pragma omp taskwait 6988 } 6989 #pragma omp parallel sections 6990 { 6991 #pragma omp flush 6992 } 6993 #pragma omp parallel sections 6994 { 6995 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 6996 bar(); 6997 } 6998 #pragma omp parallel sections 6999 { 7000 #pragma omp atomic 7001 ++a; 7002 } 7003 #pragma omp parallel sections 7004 { 7005 #pragma omp target 7006 ++a; 7007 } 7008 #pragma omp parallel sections 7009 { 7010 #pragma omp target parallel 7011 ++a; 7012 } 7013 #pragma omp parallel sections 7014 { 7015 #pragma omp target parallel for 7016 for (int i = 0; i < 10; ++i) 7017 ; 7018 } 7019 #pragma omp parallel sections 7020 { 7021 #pragma omp target enter data map(to: a) 7022 } 7023 #pragma omp parallel sections 7024 { 7025 #pragma omp target exit data map(from: a) 7026 } 7027 #pragma omp parallel sections 7028 { 7029 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 7030 ++a; 7031 } 7032 #pragma omp parallel sections 7033 { 7034 #pragma omp taskloop 7035 for (int i = 0; i < 10; ++i) 7036 ++a; 7037 } 7038 #pragma omp parallel sections 7039 { 7040 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 7041 for (int i = 0; i < 10; ++i) 7042 ; 7043 } 7044 #pragma omp parallel sections 7045 { 7046 #pragma omp target update to(a) 7047 } 7048 #pragma omp parallel sections 7049 { 7050 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 7051 for (int i = 0; i < 10; ++i) 7052 ; 7053 } 7054 #pragma omp parallel sections 7055 { 7056 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 7057 for (int i = 0; i < 10; ++i) 7058 ; 7059 } 7060 #pragma omp parallel sections 7061 { 7062 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 7063 for (int i = 0; i < 10; ++i) 7064 ; 7065 } 7066 7067 // TASK DIRECTIVE 7068 #pragma omp task 7069 #pragma omp for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 7070 for (int i = 0; i < 10; ++i) 7071 ; 7072 #pragma omp task 7073 #pragma omp simd 7074 for (int i = 0; i < 10; ++i) 7075 ; 7076 #pragma omp task 7077 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 7078 for (int i = 0; i < 10; ++i) 7079 ; 7080 #pragma omp task 7081 #pragma omp sections // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 7082 { 7083 bar(); 7084 } 7085 #pragma omp task 7086 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a task region}} 7087 { 7088 bar(); 7089 } 7090 #pragma omp task 7091 #pragma omp single // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 7092 bar(); 7093 #pragma omp task 7094 #pragma omp master // expected-error {{region cannot be closely nested inside 'task' region}} 7095 bar(); 7096 #pragma omp task 7097 #pragma omp critical 7098 bar(); 7099 #pragma omp task 7100 #pragma omp parallel for 7101 for (int i = 0; i < 10; ++i) 7102 ; 7103 #pragma omp task 7104 #pragma omp parallel for simd 7105 for (int i = 0; i < 10; ++i) 7106 ; 7107 #pragma omp task 7108 #pragma omp parallel sections 7109 { 7110 bar(); 7111 } 7112 #pragma omp task 7113 #pragma omp task 7114 { 7115 bar(); 7116 } 7117 #pragma omp task 7118 { 7119 #pragma omp taskyield 7120 bar(); 7121 } 7122 #pragma omp task 7123 { 7124 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}} 7125 bar(); 7126 } 7127 #pragma omp task 7128 { 7129 #pragma omp taskwait 7130 bar(); 7131 } 7132 #pragma omp task 7133 { 7134 #pragma omp flush 7135 bar(); 7136 } 7137 #pragma omp task 7138 { 7139 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 7140 bar(); 7141 } 7142 #pragma omp task 7143 { 7144 #pragma omp atomic 7145 ++a; 7146 } 7147 #pragma omp task 7148 { 7149 #pragma omp target 7150 ++a; 7151 } 7152 #pragma omp task 7153 { 7154 #pragma omp target parallel 7155 ++a; 7156 } 7157 #pragma omp task 7158 #pragma omp target parallel for 7159 for (int i = 0; i < 10; ++i) 7160 ; 7161 #pragma omp task 7162 { 7163 #pragma omp target enter data map(to: a) 7164 ++a; 7165 } 7166 #pragma omp task 7167 { 7168 #pragma omp target exit data map(from: a) 7169 ++a; 7170 } 7171 #pragma omp task 7172 { 7173 #pragma omp teams // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 7174 ++a; 7175 } 7176 #pragma omp task 7177 { 7178 #pragma omp taskloop 7179 for (int i = 0; i < 10; ++i) 7180 ++a; 7181 } 7182 #pragma omp task 7183 { 7184 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 7185 for (int i = 0; i < 10; ++i) 7186 ; 7187 } 7188 #pragma omp task 7189 { 7190 #pragma omp target update to(a) 7191 a++; 7192 } 7193 #pragma omp task 7194 { 7195 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 7196 for (int i = 0; i < 10; ++i) 7197 ; 7198 } 7199 #pragma omp task 7200 { 7201 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 7202 for (int i = 0; i < 10; ++i) 7203 ; 7204 } 7205 #pragma omp task 7206 { 7207 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 7208 for (int i = 0; i < 10; ++i) 7209 ; 7210 } 7211 7212 // ATOMIC DIRECTIVE 7213 #pragma omp atomic 7214 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7215 // expected-note@+1 {{expected an expression statement}} 7216 { 7217 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7218 for (int i = 0; i < 10; ++i) 7219 ; 7220 } 7221 #pragma omp atomic 7222 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7223 // expected-note@+1 {{expected an expression statement}} 7224 { 7225 #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7226 for (int i = 0; i < 10; ++i) 7227 ; 7228 } 7229 #pragma omp atomic 7230 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7231 // expected-note@+1 {{expected an expression statement}} 7232 { 7233 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7234 for (int i = 0; i < 10; ++i) 7235 ; 7236 } 7237 #pragma omp atomic 7238 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7239 // expected-note@+1 {{expected an expression statement}} 7240 { 7241 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7242 for (int i = 0; i < 10; ++i) 7243 ; 7244 } 7245 #pragma omp atomic 7246 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7247 // expected-note@+1 {{expected an expression statement}} 7248 { 7249 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7250 { 7251 bar(); 7252 } 7253 } 7254 #pragma omp atomic 7255 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7256 // expected-note@+1 {{expected an expression statement}} 7257 { 7258 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7259 { 7260 bar(); 7261 } 7262 } 7263 #pragma omp atomic 7264 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7265 // expected-note@+1 {{expected an expression statement}} 7266 { 7267 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7268 { 7269 bar(); 7270 } 7271 } 7272 #pragma omp atomic 7273 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7274 // expected-note@+1 {{expected an expression statement}} 7275 { 7276 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7277 { 7278 bar(); 7279 } 7280 } 7281 #pragma omp atomic 7282 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7283 // expected-note@+1 {{expected an expression statement}} 7284 { 7285 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7286 { 7287 bar(); 7288 } 7289 } 7290 #pragma omp atomic 7291 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7292 // expected-note@+1 {{expected an expression statement}} 7293 { 7294 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7295 for (int i = 0; i < 10; ++i) 7296 ; 7297 } 7298 #pragma omp atomic 7299 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7300 // expected-note@+1 {{expected an expression statement}} 7301 { 7302 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7303 for (int i = 0; i < 10; ++i) 7304 ; 7305 } 7306 #pragma omp atomic 7307 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7308 // expected-note@+1 {{expected an expression statement}} 7309 { 7310 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7311 { 7312 bar(); 7313 } 7314 } 7315 #pragma omp atomic 7316 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7317 // expected-note@+1 {{expected an expression statement}} 7318 { 7319 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7320 { 7321 bar(); 7322 } 7323 } 7324 #pragma omp atomic 7325 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7326 // expected-note@+1 {{expected an expression statement}} 7327 { 7328 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7329 bar(); 7330 } 7331 #pragma omp atomic 7332 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7333 // expected-note@+1 {{expected an expression statement}} 7334 { 7335 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7336 bar(); 7337 } 7338 #pragma omp atomic 7339 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7340 // expected-note@+1 {{expected an expression statement}} 7341 { 7342 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7343 bar(); 7344 } 7345 #pragma omp atomic 7346 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7347 // expected-note@+1 {{expected an expression statement}} 7348 { 7349 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7350 bar(); 7351 } 7352 #pragma omp atomic 7353 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7354 // expected-note@+1 {{expected an expression statement}} 7355 { 7356 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7357 bar(); 7358 } 7359 #pragma omp atomic 7360 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7361 // expected-note@+1 {{expected an expression statement}} 7362 { 7363 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7364 ++a; 7365 } 7366 #pragma omp atomic 7367 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7368 // expected-note@+1 {{expected an expression statement}} 7369 { 7370 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7371 ++a; 7372 } 7373 #pragma omp atomic 7374 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7375 // expected-note@+1 {{expected an expression statement}} 7376 { 7377 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7378 ++a; 7379 } 7380 #pragma omp atomic 7381 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7382 // expected-note@+1 {{expected an expression statement}} 7383 { 7384 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7385 for (int i = 0; i < 10; ++i) 7386 ; 7387 } 7388 #pragma omp atomic 7389 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7390 // expected-note@+1 {{expected an expression statement}} 7391 { 7392 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7393 ++a; 7394 } 7395 #pragma omp atomic 7396 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7397 // expected-note@+1 {{expected an expression statement}} 7398 { 7399 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7400 ++a; 7401 } 7402 #pragma omp atomic 7403 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7404 // expected-note@+1 {{expected an expression statement}} 7405 { 7406 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7407 ++a; 7408 } 7409 #pragma omp atomic 7410 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7411 // expected-note@+1 {{expected an expression statement}} 7412 { 7413 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7414 for (int i = 0; i < 10; ++i) 7415 ++a; 7416 } 7417 #pragma omp atomic 7418 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7419 // expected-note@+1 {{expected an expression statement}} 7420 { 7421 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7422 for (int i = 0; i < 10; ++i) 7423 ; 7424 } 7425 #pragma omp atomic 7426 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7427 // expected-note@+1 {{expected an expression statement}} 7428 { 7429 #pragma omp target update // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7430 } 7431 #pragma omp atomic 7432 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7433 // expected-note@+1 {{expected an expression statement}} 7434 { 7435 #pragma omp distribute parallel for// expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7436 for (int i = 0; i < 10; ++i) 7437 ; 7438 } 7439 #pragma omp atomic 7440 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7441 // expected-note@+1 {{expected an expression statement}} 7442 { 7443 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7444 for (int i = 0; i < 10; ++i) 7445 ; 7446 } 7447 #pragma omp atomic 7448 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7449 // expected-note@+1 {{expected an expression statement}} 7450 { 7451 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7452 for (int i = 0; i < 10; ++i) 7453 ; 7454 } 7455 7456 // TARGET DIRECTIVE 7457 #pragma omp target 7458 #pragma omp parallel 7459 bar(); 7460 #pragma omp target 7461 #pragma omp for 7462 for (int i = 0; i < 10; ++i) 7463 ; 7464 #pragma omp target 7465 #pragma omp simd 7466 for (int i = 0; i < 10; ++i) 7467 ; 7468 #pragma omp target 7469 #pragma omp for simd 7470 for (int i = 0; i < 10; ++i) 7471 ; 7472 #pragma omp target 7473 #pragma omp sections 7474 { 7475 bar(); 7476 } 7477 #pragma omp target 7478 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target region}} 7479 { 7480 bar(); 7481 } 7482 #pragma omp target 7483 #pragma omp single 7484 bar(); 7485 7486 #pragma omp target 7487 #pragma omp master 7488 { 7489 bar(); 7490 } 7491 #pragma omp target 7492 #pragma omp critical 7493 { 7494 bar(); 7495 } 7496 #pragma omp target 7497 #pragma omp parallel for 7498 for (int i = 0; i < 10; ++i) 7499 ; 7500 #pragma omp target 7501 #pragma omp parallel for simd 7502 for (int i = 0; i < 10; ++i) 7503 ; 7504 #pragma omp target 7505 #pragma omp parallel sections 7506 { 7507 bar(); 7508 } 7509 #pragma omp target 7510 #pragma omp task 7511 { 7512 bar(); 7513 } 7514 #pragma omp target 7515 { 7516 #pragma omp taskyield 7517 bar(); 7518 } 7519 #pragma omp target 7520 { 7521 #pragma omp barrier 7522 bar(); 7523 } 7524 #pragma omp target 7525 { 7526 #pragma omp taskwait 7527 bar(); 7528 } 7529 #pragma omp target 7530 { 7531 #pragma omp flush 7532 bar(); 7533 } 7534 #pragma omp target 7535 { 7536 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 7537 bar(); 7538 } 7539 #pragma omp target 7540 { 7541 #pragma omp atomic 7542 ++a; 7543 } 7544 #pragma omp target 7545 { 7546 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}} 7547 ++a; 7548 } 7549 #pragma omp target 7550 { 7551 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}} 7552 ++a; 7553 } 7554 #pragma omp target 7555 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}} 7556 for (int i = 0; i < 10; ++i) 7557 ; 7558 #pragma omp target 7559 { 7560 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}} 7561 } 7562 #pragma omp target 7563 { 7564 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}} 7565 } 7566 #pragma omp target 7567 { 7568 #pragma omp teams 7569 ++a; 7570 } 7571 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} 7572 { 7573 ++a; // expected-note {{statement outside teams construct here}} 7574 #pragma omp teams // expected-note {{nested teams construct here}} 7575 ++a; 7576 } 7577 #pragma omp target 7578 { 7579 #pragma omp taskloop 7580 for (int i = 0; i < 10; ++i) 7581 ++a; 7582 } 7583 #pragma omp target 7584 { 7585 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 7586 for (int i = 0; i < 10; ++i) 7587 ; 7588 } 7589 #pragma omp atomic 7590 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} 7591 // expected-note@+1 {{expected an expression statement}} 7592 { 7593 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}} 7594 a++; 7595 } 7596 #pragma omp target 7597 { 7598 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 7599 for (int i = 0; i < 10; ++i) 7600 ; 7601 } 7602 #pragma omp target 7603 { 7604 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 7605 for (int i = 0; i < 10; ++i) 7606 ; 7607 } 7608 #pragma omp target 7609 { 7610 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 7611 for (int i = 0; i < 10; ++i) 7612 ; 7613 } 7614 7615 // TARGET PARALLEL DIRECTIVE 7616 #pragma omp target parallel 7617 #pragma omp parallel 7618 bar(); 7619 #pragma omp target parallel 7620 #pragma omp for 7621 for (int i = 0; i < 10; ++i) 7622 ; 7623 #pragma omp target parallel 7624 #pragma omp simd 7625 for (int i = 0; i < 10; ++i) 7626 ; 7627 #pragma omp target parallel 7628 #pragma omp for simd 7629 for (int i = 0; i < 10; ++i) 7630 ; 7631 #pragma omp target parallel 7632 #pragma omp sections 7633 { 7634 bar(); 7635 } 7636 #pragma omp target parallel 7637 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel region}} 7638 { 7639 bar(); 7640 } 7641 #pragma omp target parallel 7642 #pragma omp single 7643 bar(); 7644 7645 #pragma omp target parallel 7646 #pragma omp master 7647 { 7648 bar(); 7649 } 7650 #pragma omp target parallel 7651 #pragma omp critical 7652 { 7653 bar(); 7654 } 7655 #pragma omp target parallel 7656 #pragma omp parallel for 7657 for (int i = 0; i < 10; ++i) 7658 ; 7659 #pragma omp target parallel 7660 #pragma omp parallel for simd 7661 for (int i = 0; i < 10; ++i) 7662 ; 7663 #pragma omp target parallel 7664 #pragma omp parallel sections 7665 { 7666 bar(); 7667 } 7668 #pragma omp target parallel 7669 #pragma omp task 7670 { 7671 bar(); 7672 } 7673 #pragma omp target parallel 7674 { 7675 #pragma omp taskyield 7676 bar(); 7677 } 7678 #pragma omp target parallel 7679 { 7680 #pragma omp barrier 7681 bar(); 7682 } 7683 #pragma omp target parallel 7684 { 7685 #pragma omp taskwait 7686 bar(); 7687 } 7688 #pragma omp target parallel 7689 { 7690 #pragma omp flush 7691 bar(); 7692 } 7693 #pragma omp target parallel 7694 { 7695 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 7696 bar(); 7697 } 7698 #pragma omp target parallel 7699 { 7700 #pragma omp atomic 7701 ++a; 7702 } 7703 #pragma omp target parallel 7704 { 7705 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel' region}} 7706 ++a; 7707 } 7708 #pragma omp target parallel 7709 { 7710 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel' region}} 7711 ++a; 7712 } 7713 #pragma omp target parallel 7714 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel' region}} 7715 for (int i = 0; i < 10; ++i) 7716 ; 7717 #pragma omp target parallel 7718 { 7719 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 7720 ++a; 7721 } 7722 #pragma omp target parallel 7723 { 7724 ++a; 7725 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 7726 ++a; 7727 } 7728 #pragma omp target parallel 7729 { 7730 #pragma omp taskloop 7731 for (int i = 0; i < 10; ++i) 7732 ++a; 7733 } 7734 #pragma omp target parallel 7735 { 7736 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 7737 for (int i = 0; i < 10; ++i) 7738 ; 7739 } 7740 #pragma omp target parallel 7741 { 7742 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel' region}} 7743 } 7744 #pragma omp target parallel 7745 { 7746 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel' region}} 7747 } 7748 #pragma omp target parallel 7749 { 7750 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel' region}} 7751 } 7752 #pragma omp target parallel 7753 { 7754 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 7755 for (int i = 0; i < 10; ++i) 7756 ; 7757 } 7758 #pragma omp target parallel 7759 { 7760 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 7761 for (int i = 0; i < 10; ++i) 7762 ; 7763 } 7764 #pragma omp target parallel 7765 { 7766 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 7767 for (int i = 0; i < 10; ++i) 7768 ; 7769 } 7770 7771 // TARGET PARALLEL FOR DIRECTIVE 7772 #pragma omp target parallel for 7773 for (int i = 0; i < 10; ++i) { 7774 #pragma omp for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 7775 for (int i = 0; i < 10; ++i) 7776 ; 7777 } 7778 #pragma omp target parallel for 7779 for (int i = 0; i < 10; ++i) { 7780 #pragma omp simd 7781 for (int i = 0; i < 10; ++i) 7782 ; 7783 } 7784 #pragma omp target parallel for 7785 for (int i = 0; i < 10; ++i) { 7786 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 7787 for (int i = 0; i < 10; ++i) 7788 ; 7789 } 7790 #pragma omp target parallel for 7791 for (int i = 0; i < 10; ++i) { 7792 #pragma omp parallel 7793 for (int i = 0; i < 10; ++i) 7794 ; 7795 } 7796 #pragma omp target parallel for 7797 for (int i = 0; i < 10; ++i) { 7798 #pragma omp sections // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 7799 { 7800 bar(); 7801 } 7802 } 7803 #pragma omp target parallel for 7804 for (int i = 0; i < 10; ++i) { 7805 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel for region}} 7806 { 7807 bar(); 7808 } 7809 } 7810 #pragma omp target parallel for 7811 for (int i = 0; i < 10; ++i) { 7812 #pragma omp single // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 7813 { 7814 bar(); 7815 } 7816 } 7817 7818 #pragma omp target parallel for 7819 for (int i = 0; i < 10; ++i) { 7820 #pragma omp master // expected-error {{region cannot be closely nested inside 'target parallel for' region}} 7821 { 7822 bar(); 7823 } 7824 } 7825 7826 #pragma omp target parallel for 7827 for (int i = 0; i < 10; ++i) { 7828 #pragma omp critical 7829 { 7830 bar(); 7831 } 7832 } 7833 7834 #pragma omp target parallel for 7835 for (int i = 0; i < 10; ++i) { 7836 #pragma omp parallel 7837 { 7838 #pragma omp single // OK 7839 { 7840 bar(); 7841 } 7842 #pragma omp for // OK 7843 for (int i = 0; i < 10; ++i) 7844 ; 7845 #pragma omp for simd // OK 7846 for (int i = 0; i < 10; ++i) 7847 ; 7848 #pragma omp sections // OK 7849 { 7850 bar(); 7851 } 7852 } 7853 } 7854 #pragma omp target parallel for 7855 for (int i = 0; i < 10; ++i) { 7856 #pragma omp parallel for 7857 for (int i = 0; i < 10; ++i) 7858 ; 7859 } 7860 #pragma omp target parallel for 7861 for (int i = 0; i < 10; ++i) { 7862 #pragma omp parallel for simd 7863 for (int i = 0; i < 10; ++i) 7864 ; 7865 } 7866 #pragma omp target parallel for 7867 for (int i = 0; i < 10; ++i) { 7868 #pragma omp parallel sections 7869 { 7870 bar(); 7871 } 7872 } 7873 #pragma omp target parallel for 7874 for (int i = 0; i < 10; ++i) { 7875 #pragma omp task 7876 { 7877 bar(); 7878 } 7879 } 7880 #pragma omp target parallel for 7881 for (int i = 0; i < 10; ++i) { 7882 #pragma omp taskyield 7883 bar(); 7884 } 7885 #pragma omp target parallel for 7886 for (int i = 0; i < 10; ++i) { 7887 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target parallel for' region}} 7888 bar(); 7889 } 7890 #pragma omp target parallel for 7891 for (int i = 0; i < 10; ++i) { 7892 #pragma omp taskwait 7893 bar(); 7894 } 7895 #pragma omp target parallel for 7896 for (int i = 0; i < 10; ++i) { 7897 #pragma omp flush 7898 bar(); 7899 } 7900 #pragma omp target parallel for 7901 for (int i = 0; i < 10; ++i) { 7902 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 7903 bar(); 7904 } 7905 #pragma omp target parallel for ordered 7906 for (int i = 0; i < 10; ++i) { 7907 #pragma omp ordered // OK 7908 bar(); 7909 } 7910 #pragma omp target parallel for 7911 for (int i = 0; i < 10; ++i) { 7912 #pragma omp atomic 7913 ++a; 7914 } 7915 #pragma omp target parallel for 7916 for (int i = 0; i < 10; ++i) { 7917 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel for' region}} 7918 ++a; 7919 } 7920 #pragma omp target parallel for 7921 for (int i = 0; i < 10; ++i) { 7922 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel for' region}} 7923 ++a; 7924 } 7925 #pragma omp target parallel for 7926 for (int i = 0; i < 10; ++i) { 7927 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}} 7928 for (int i = 0; i < 10; ++i) 7929 ; 7930 } 7931 #pragma omp target parallel for 7932 for (int i = 0; i < 10; ++i) { 7933 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel for' region}} 7934 ++a; 7935 } 7936 #pragma omp target parallel for 7937 for (int i = 0; i < 10; ++i) { 7938 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel for' region}} 7939 ++a; 7940 } 7941 #pragma omp target parallel for 7942 for (int i = 0; i < 10; ++i) { 7943 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 7944 ++a; 7945 } 7946 #pragma omp target parallel for 7947 for (int i = 0; i < 10; ++i) { 7948 #pragma omp taskloop 7949 for (int i = 0; i < 10; ++i) 7950 ++a; 7951 } 7952 #pragma omp target parallel for 7953 for (int i = 0; i < 10; ++i) { 7954 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 7955 for (int j = 0; j < 10; ++j) 7956 ; 7957 } 7958 #pragma omp target parallel for 7959 for (int i = 0; i < 10; ++i) { 7960 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel for' region}} 7961 a++; 7962 } 7963 #pragma omp target parallel for 7964 for (int i = 0; i < 10; ++i) { 7965 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 7966 for (int j = 0; j < 10; ++j) 7967 ; 7968 } 7969 #pragma omp target parallel for 7970 for (int i = 0; i < 10; ++i) { 7971 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 7972 for (int j = 0; j < 10; ++j) 7973 ; 7974 } 7975 #pragma omp target parallel for 7976 for (int i = 0; i < 10; ++i) { 7977 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 7978 for (int j = 0; j < 10; ++j) 7979 ; 7980 } 7981 7982 // TEAMS DIRECTIVE 7983 #pragma omp target 7984 #pragma omp teams 7985 #pragma omp parallel 7986 bar(); 7987 #pragma omp target 7988 #pragma omp teams 7989 #pragma omp for // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 7990 for (int i = 0; i < 10; ++i) 7991 ; 7992 #pragma omp target 7993 #pragma omp teams 7994 #pragma omp simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp simd' directive into a parallel region?}} 7995 for (int i = 0; i < 10; ++i) 7996 ; 7997 #pragma omp target 7998 #pragma omp teams 7999 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 8000 for (int i = 0; i < 10; ++i) 8001 ; 8002 #pragma omp target 8003 #pragma omp teams 8004 #pragma omp sections // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 8005 { 8006 bar(); 8007 } 8008 #pragma omp target 8009 #pragma omp teams 8010 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams region}} 8011 { 8012 bar(); 8013 } 8014 #pragma omp target 8015 #pragma omp teams 8016 #pragma omp single // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 8017 bar(); 8018 8019 #pragma omp target 8020 #pragma omp teams 8021 #pragma omp master // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp master' directive into a parallel region?}} 8022 { 8023 bar(); 8024 } 8025 #pragma omp target 8026 #pragma omp teams 8027 #pragma omp critical // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp critical' directive into a parallel region?}} 8028 { 8029 bar(); 8030 } 8031 #pragma omp target 8032 #pragma omp teams 8033 #pragma omp parallel for 8034 for (int i = 0; i < 10; ++i) 8035 ; 8036 #pragma omp target 8037 #pragma omp teams 8038 #pragma omp parallel for simd 8039 for (int i = 0; i < 10; ++i) 8040 ; 8041 #pragma omp target 8042 #pragma omp teams 8043 #pragma omp parallel sections 8044 { 8045 bar(); 8046 } 8047 #pragma omp target 8048 #pragma omp teams 8049 #pragma omp task // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp task' directive into a parallel region?}} 8050 { 8051 bar(); 8052 } 8053 #pragma omp target 8054 #pragma omp teams 8055 { 8056 #pragma omp taskyield // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskyield' directive into a parallel region?}} 8057 bar(); 8058 } 8059 #pragma omp target 8060 #pragma omp teams 8061 { 8062 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp barrier' directive into a parallel region?}} 8063 bar(); 8064 } 8065 #pragma omp target 8066 #pragma omp teams 8067 { 8068 #pragma omp taskwait // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskwait' directive into a parallel region?}} 8069 bar(); 8070 } 8071 #pragma omp target 8072 #pragma omp teams 8073 { 8074 #pragma omp flush // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp flush' directive into a parallel region?}} 8075 bar(); 8076 } 8077 #pragma omp target 8078 #pragma omp teams 8079 { 8080 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 8081 bar(); 8082 } 8083 #pragma omp target 8084 #pragma omp teams 8085 { 8086 #pragma omp atomic // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp atomic' directive into a parallel region?}} 8087 ++a; 8088 } 8089 #pragma omp target 8090 #pragma omp teams 8091 { 8092 #pragma omp target // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target' directive into a parallel region?}} 8093 ++a; 8094 } 8095 #pragma omp target 8096 #pragma omp teams 8097 { 8098 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}} 8099 ++a; 8100 } 8101 #pragma omp target 8102 #pragma omp teams 8103 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}} 8104 for (int i = 0; i < 10; ++i) 8105 ; 8106 #pragma omp target 8107 #pragma omp teams 8108 { 8109 #pragma omp target enter data map(to: a) // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target enter data' directive into a parallel region?}} 8110 } 8111 #pragma omp target 8112 #pragma omp teams 8113 { 8114 #pragma omp target exit data map(from: a) // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target exit data' directive into a parallel region?}} 8115 } 8116 #pragma omp target 8117 #pragma omp teams 8118 { 8119 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 8120 ++a; 8121 } 8122 #pragma omp target 8123 #pragma omp teams 8124 { 8125 #pragma omp taskloop // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskloop' directive into a parallel region?}} 8126 for (int i = 0; i < 10; ++i) 8127 ++a; 8128 } 8129 #pragma omp target 8130 #pragma omp teams 8131 #pragma omp distribute 8132 for (int i = 0; i < 10; ++i) 8133 ; 8134 #pragma omp target 8135 #pragma omp teams 8136 #pragma omp distribute 8137 for (int i = 0; i < 10; ++i) 8138 ; 8139 #pragma omp distribute 8140 for (int j = 0; j < 10; ++j) 8141 ; 8142 #pragma omp target 8143 #pragma omp teams 8144 { 8145 #pragma omp target update to(a) // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp target update' directive into a parallel region?}} 8146 ++a; 8147 } 8148 #pragma omp target 8149 #pragma omp teams 8150 #pragma omp distribute parallel for 8151 for (int i = 0; i < 10; ++i) 8152 ; 8153 #pragma omp target 8154 #pragma omp teams 8155 { 8156 #pragma omp distribute parallel for 8157 for (int i = 0; i < 10; ++i) 8158 ; 8159 #pragma omp distribute parallel for 8160 for (int j = 0; j < 10; ++j) 8161 ; 8162 } 8163 #pragma omp target 8164 #pragma omp teams 8165 { 8166 #pragma omp distribute parallel for simd 8167 for (int i = 0; i < 10; ++i) 8168 ; 8169 #pragma omp distribute parallel for simd 8170 for (int j = 0; j < 10; ++j) 8171 ; 8172 } 8173 #pragma omp target 8174 #pragma omp teams 8175 { 8176 #pragma omp distribute simd 8177 for (int i = 0; i < 10; ++i) 8178 ; 8179 #pragma omp distribute simd 8180 for (int j = 0; j < 10; ++j) 8181 ; 8182 } 8183 8184 // TASKLOOP DIRECTIVE 8185 #pragma omp taskloop 8186 for (int i = 0; i < 10; ++i) { 8187 #pragma omp for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 8188 for (int i = 0; i < 10; ++i) 8189 ; 8190 } 8191 #pragma omp taskloop 8192 for (int i = 0; i < 10; ++i) { 8193 #pragma omp simd 8194 for (int i = 0; i < 10; ++i) 8195 ; 8196 } 8197 #pragma omp taskloop 8198 for (int i = 0; i < 10; ++i) { 8199 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 8200 for (int i = 0; i < 10; ++i) 8201 ; 8202 } 8203 #pragma omp taskloop 8204 for (int i = 0; i < 10; ++i) { 8205 #pragma omp parallel 8206 for (int i = 0; i < 10; ++i) 8207 ; 8208 } 8209 #pragma omp taskloop 8210 for (int i = 0; i < 10; ++i) { 8211 #pragma omp sections // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 8212 { 8213 bar(); 8214 } 8215 } 8216 #pragma omp taskloop 8217 for (int i = 0; i < 10; ++i) { 8218 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a taskloop region}} 8219 { 8220 bar(); 8221 } 8222 } 8223 #pragma omp taskloop 8224 for (int i = 0; i < 10; ++i) { 8225 #pragma omp single // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 8226 { 8227 bar(); 8228 } 8229 } 8230 8231 #pragma omp taskloop 8232 for (int i = 0; i < 10; ++i) { 8233 #pragma omp master // expected-error {{region cannot be closely nested inside 'taskloop' region}} 8234 { 8235 bar(); 8236 } 8237 } 8238 #pragma omp taskloop 8239 for (int i = 0; i < 10; ++i) { 8240 #pragma omp critical 8241 { 8242 bar(); 8243 } 8244 } 8245 #pragma omp taskloop 8246 for (int i = 0; i < 10; ++i) { 8247 #pragma omp parallel 8248 { 8249 #pragma omp single // OK 8250 { 8251 bar(); 8252 } 8253 #pragma omp for // OK 8254 for (int i = 0; i < 10; ++i) 8255 ; 8256 #pragma omp sections // OK 8257 { 8258 bar(); 8259 } 8260 } 8261 } 8262 #pragma omp taskloop 8263 for (int i = 0; i < 10; ++i) { 8264 #pragma omp parallel for 8265 for (int i = 0; i < 10; ++i) 8266 ; 8267 } 8268 #pragma omp taskloop 8269 for (int i = 0; i < 10; ++i) { 8270 #pragma omp parallel for simd 8271 for (int i = 0; i < 10; ++i) 8272 ; 8273 } 8274 #pragma omp taskloop 8275 for (int i = 0; i < 10; ++i) { 8276 #pragma omp parallel sections 8277 { 8278 bar(); 8279 } 8280 } 8281 #pragma omp taskloop 8282 for (int i = 0; i < 10; ++i) { 8283 #pragma omp task 8284 { 8285 bar(); 8286 } 8287 } 8288 #pragma omp taskloop 8289 for (int i = 0; i < 10; ++i) { 8290 #pragma omp taskyield 8291 bar(); 8292 } 8293 #pragma omp taskloop 8294 for (int i = 0; i < 10; ++i) { 8295 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'taskloop' region}} 8296 bar(); 8297 } 8298 #pragma omp taskloop 8299 for (int i = 0; i < 10; ++i) { 8300 #pragma omp taskwait 8301 bar(); 8302 } 8303 #pragma omp taskloop 8304 for (int i = 0; i < 10; ++i) { 8305 #pragma omp flush 8306 bar(); 8307 } 8308 #pragma omp taskloop 8309 for (int i = 0; i < 10; ++i) { 8310 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 8311 bar(); 8312 } 8313 #pragma omp taskloop 8314 for (int i = 0; i < 10; ++i) { 8315 #pragma omp atomic 8316 ++a; 8317 } 8318 #pragma omp taskloop 8319 for (int i = 0; i < 10; ++i) { 8320 #pragma omp target 8321 ++a; 8322 } 8323 #pragma omp taskloop 8324 for (int i = 0; i < 10; ++i) { 8325 #pragma omp target parallel 8326 ++a; 8327 } 8328 #pragma omp taskloop 8329 for (int i = 0; i < 10; ++i) { 8330 #pragma omp target parallel for 8331 for (int i = 0; i < 10; ++i) 8332 ; 8333 } 8334 #pragma omp taskloop 8335 for (int i = 0; i < 10; ++i) { 8336 #pragma omp target enter data map(to: a) 8337 ++a; 8338 } 8339 #pragma omp taskloop 8340 for (int i = 0; i < 10; ++i) { 8341 #pragma omp target exit data map(from: a) 8342 ++a; 8343 } 8344 #pragma omp taskloop 8345 for (int i = 0; i < 10; ++i) { 8346 #pragma omp teams // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 8347 ++a; 8348 } 8349 #pragma omp taskloop 8350 for (int i = 0; i < 10; ++i) { 8351 #pragma omp taskloop 8352 for (int i = 0; i < 10; ++i) 8353 ++a; 8354 } 8355 #pragma omp taskloop 8356 for (int i = 0; i < 10; ++i) { 8357 #pragma omp target update to(a) 8358 ++a; 8359 } 8360 #pragma omp taskloop 8361 for (int i = 0; i < 10; ++i) { 8362 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 8363 for (int i = 0; i < 10; ++i) 8364 ; 8365 } 8366 #pragma omp taskloop 8367 for (int i = 0; i < 10; ++i) { 8368 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 8369 for (int i = 0; i < 10; ++i) 8370 ; 8371 } 8372 #pragma omp taskloop 8373 for (int i = 0; i < 10; ++i) { 8374 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 8375 for (int i = 0; i < 10; ++i) 8376 ; 8377 } 8378 #pragma omp taskloop 8379 for (int i = 0; i < 10; ++i) { 8380 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 8381 for (int i = 0; i < 10; ++i) 8382 ; 8383 } 8384 8385 // DISTRIBUTE DIRECTIVE 8386 #pragma omp target 8387 #pragma omp teams 8388 #pragma omp distribute 8389 for (int i = 0; i < 10; ++i) { 8390 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 8391 for (int i = 0; i < 10; ++i) 8392 ; 8393 } 8394 #pragma omp target 8395 #pragma omp teams 8396 #pragma omp distribute 8397 for (int i = 0; i < 10; ++i) { 8398 #pragma omp for 8399 for (int i = 0; i < 10; ++i) 8400 ; 8401 } 8402 #pragma omp target 8403 #pragma omp teams 8404 #pragma omp distribute 8405 for (int i = 0; i < 10; ++i) { 8406 #pragma omp simd 8407 for (int i = 0; i < 10; ++i) 8408 ; 8409 } 8410 #pragma omp target 8411 #pragma omp teams 8412 #pragma omp distribute 8413 for (int i = 0; i < 10; ++i) { 8414 #pragma omp for simd 8415 for (int i = 0; i < 10; ++i) 8416 ; 8417 } 8418 #pragma omp target 8419 #pragma omp teams 8420 #pragma omp distribute 8421 for (int i = 0; i < 10; ++i) { 8422 #pragma omp parallel 8423 for (int i = 0; i < 10; ++i) 8424 ; 8425 } 8426 #pragma omp target 8427 #pragma omp teams 8428 #pragma omp distribute 8429 for (int i = 0; i < 10; ++i) { 8430 #pragma omp sections 8431 { 8432 bar(); 8433 } 8434 } 8435 #pragma omp target 8436 #pragma omp teams 8437 #pragma omp distribute 8438 for (int i = 0; i < 10; ++i) { 8439 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute region}} 8440 { 8441 bar(); 8442 } 8443 } 8444 #pragma omp target 8445 #pragma omp teams 8446 #pragma omp distribute 8447 for (int i = 0; i < 10; ++i) { 8448 #pragma omp single 8449 { 8450 bar(); 8451 } 8452 } 8453 #pragma omp target 8454 #pragma omp teams 8455 #pragma omp distribute 8456 for (int i = 0; i < 10; ++i) { 8457 #pragma omp master 8458 { 8459 bar(); 8460 } 8461 } 8462 #pragma omp target 8463 #pragma omp teams 8464 #pragma omp distribute 8465 for (int i = 0; i < 10; ++i) { 8466 #pragma omp critical 8467 { 8468 bar(); 8469 } 8470 } 8471 #pragma omp target 8472 #pragma omp teams 8473 #pragma omp distribute 8474 for (int i = 0; i < 10; ++i) { 8475 #pragma omp parallel 8476 { 8477 #pragma omp single 8478 { 8479 bar(); 8480 } 8481 } 8482 } 8483 #pragma omp target 8484 #pragma omp teams 8485 #pragma omp distribute 8486 for (int i = 0; i < 10; ++i) { 8487 #pragma omp parallel for 8488 for (int i = 0; i < 10; ++i) 8489 ; 8490 } 8491 #pragma omp target 8492 #pragma omp teams 8493 #pragma omp distribute 8494 for (int i = 0; i < 10; ++i) { 8495 #pragma omp parallel for simd 8496 for (int i = 0; i < 10; ++i) 8497 ; 8498 } 8499 #pragma omp target 8500 #pragma omp teams 8501 #pragma omp distribute 8502 for (int i = 0; i < 10; ++i) { 8503 #pragma omp parallel sections 8504 { 8505 bar(); 8506 } 8507 } 8508 #pragma omp target 8509 #pragma omp teams 8510 #pragma omp distribute 8511 for (int i = 0; i < 10; ++i) { 8512 #pragma omp task 8513 { 8514 bar(); 8515 } 8516 } 8517 #pragma omp target 8518 #pragma omp teams 8519 #pragma omp distribute 8520 for (int i = 0; i < 10; ++i) { 8521 #pragma omp taskyield 8522 bar(); 8523 } 8524 #pragma omp target 8525 #pragma omp teams 8526 #pragma omp distribute 8527 for (int i = 0; i < 10; ++i) { 8528 #pragma omp barrier 8529 bar(); 8530 } 8531 #pragma omp target 8532 #pragma omp teams 8533 #pragma omp distribute 8534 for (int i = 0; i < 10; ++i) { 8535 #pragma omp taskwait 8536 bar(); 8537 } 8538 #pragma omp target 8539 #pragma omp teams 8540 #pragma omp distribute 8541 for (int i = 0; i < 10; ++i) { 8542 #pragma omp flush 8543 bar(); 8544 } 8545 #pragma omp target 8546 #pragma omp teams 8547 #pragma omp distribute 8548 for (int i = 0; i < 10; ++i) { 8549 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 8550 bar(); 8551 } 8552 #pragma omp target 8553 #pragma omp teams 8554 #pragma omp distribute 8555 for (int i = 0; i < 10; ++i) { 8556 #pragma omp atomic 8557 ++a; 8558 } 8559 #pragma omp target 8560 #pragma omp teams 8561 #pragma omp distribute 8562 for (int i = 0; i < 10; ++i) { 8563 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}} 8564 ++a; 8565 } 8566 #pragma omp target 8567 #pragma omp teams 8568 #pragma omp distribute 8569 for (int i = 0; i < 10; ++i) { 8570 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}} 8571 ++a; 8572 } 8573 #pragma omp target 8574 #pragma omp teams 8575 #pragma omp distribute 8576 for (int i = 0; i < 10; ++i) { 8577 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}} 8578 for (int i = 0; i < 10; ++i) 8579 ; 8580 } 8581 #pragma omp target 8582 #pragma omp teams 8583 #pragma omp distribute 8584 for (int i = 0; i < 10; ++i) { 8585 #pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 8586 ++a; 8587 } 8588 return foo<int>(); 8589 #pragma omp target 8590 #pragma omp teams 8591 #pragma omp distribute 8592 for (int i = 0; i < 10; ++i) { 8593 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}} 8594 ++a; 8595 } 8596 #pragma omp target 8597 #pragma omp teams 8598 #pragma omp distribute 8599 for (int i = 0; i < 10; ++i) { 8600 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}} 8601 ++a; 8602 } 8603 #pragma omp target 8604 #pragma omp teams 8605 #pragma omp distribute 8606 for (int i = 0; i < 10; ++i) { 8607 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}} 8608 ++a; 8609 } 8610 #pragma omp target 8611 #pragma omp teams 8612 #pragma omp distribute 8613 for (int i = 0; i < 10; ++i) { 8614 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 8615 for (int i = 0; i < 10; ++i) 8616 ++a; 8617 } 8618 #pragma omp target 8619 #pragma omp teams 8620 #pragma omp distribute 8621 for (int i = 0; i < 10; ++i) { 8622 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}} 8623 for (int i = 0; i < 10; ++i) 8624 ++a; 8625 } 8626 #pragma omp target 8627 #pragma omp teams 8628 #pragma omp distribute 8629 for (int i = 0; i < 10; ++i) { 8630 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 8631 for (int i = 0; i < 10; ++i) 8632 ++a; 8633 } 8634 8635 // DISTRIBUTE PARALLEL FOR DIRECTIVE 8636 #pragma omp target 8637 #pragma omp teams 8638 #pragma omp distribute parallel for 8639 for (int i = 0; i < 10; ++i) { 8640 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}} 8641 for (int i = 0; i < 10; ++i) 8642 ; 8643 } 8644 8645 #pragma omp target 8646 #pragma omp teams 8647 #pragma omp distribute parallel for 8648 for (int i = 0; i < 10; ++i) { 8649 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}} 8650 for (int i = 0; i < 10; ++i) 8651 ; 8652 } 8653 #pragma omp target 8654 #pragma omp teams 8655 #pragma omp distribute parallel for 8656 for (int i = 0; i < 10; ++i) { 8657 #pragma omp for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} 8658 for (int i = 0; i < 10; ++i) 8659 ; 8660 } 8661 #pragma omp target 8662 #pragma omp teams 8663 #pragma omp distribute parallel for 8664 for (int i = 0; i < 10; ++i) { 8665 #pragma omp simd 8666 for (int i = 0; i < 10; ++i) 8667 ; 8668 } 8669 #pragma omp target 8670 #pragma omp teams 8671 #pragma omp distribute parallel for 8672 for (int i = 0; i < 10; ++i) { 8673 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}} 8674 for (int i = 0; i < 10; ++i) 8675 ; 8676 } 8677 #pragma omp target 8678 #pragma omp teams 8679 #pragma omp distribute parallel for 8680 for (int i = 0; i < 10; ++i) { 8681 #pragma omp parallel 8682 for (int i = 0; i < 10; ++i) 8683 ; 8684 } 8685 #pragma omp target 8686 #pragma omp teams 8687 #pragma omp distribute parallel for 8688 for (int i = 0; i < 10; ++i) { 8689 #pragma omp sections // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}} 8690 { 8691 bar(); 8692 } 8693 } 8694 #pragma omp target 8695 #pragma omp teams 8696 #pragma omp distribute parallel for 8697 for (int i = 0; i < 10; ++i) { 8698 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute parallel for region}} 8699 { 8700 bar(); 8701 } 8702 } 8703 #pragma omp target 8704 #pragma omp teams 8705 #pragma omp distribute parallel for 8706 for (int i = 0; i < 10; ++i) { 8707 #pragma omp single // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} 8708 { 8709 bar(); 8710 } 8711 } 8712 #pragma omp target 8713 #pragma omp teams 8714 #pragma omp distribute parallel for 8715 for (int i = 0; i < 10; ++i) { 8716 #pragma omp master // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}} 8717 { 8718 bar(); 8719 } 8720 } 8721 #pragma omp target 8722 #pragma omp teams 8723 #pragma omp distribute parallel for 8724 for (int i = 0; i < 10; ++i) { 8725 #pragma omp critical 8726 { 8727 bar(); 8728 } 8729 } 8730 #pragma omp target 8731 #pragma omp teams 8732 #pragma omp distribute parallel for 8733 for (int i = 0; i < 10; ++i) { 8734 #pragma omp parallel 8735 { 8736 #pragma omp single 8737 { 8738 bar(); 8739 } 8740 } 8741 } 8742 #pragma omp target 8743 #pragma omp teams 8744 #pragma omp distribute parallel for 8745 for (int i = 0; i < 10; ++i) { 8746 #pragma omp parallel for 8747 for (int i = 0; i < 10; ++i) 8748 ; 8749 } 8750 #pragma omp target 8751 #pragma omp teams 8752 #pragma omp distribute parallel for 8753 for (int i = 0; i < 10; ++i) { 8754 #pragma omp parallel for simd 8755 for (int i = 0; i < 10; ++i) 8756 ; 8757 } 8758 #pragma omp target 8759 #pragma omp teams 8760 #pragma omp distribute parallel for 8761 for (int i = 0; i < 10; ++i) { 8762 #pragma omp parallel sections 8763 { 8764 bar(); 8765 } 8766 } 8767 #pragma omp target 8768 #pragma omp teams 8769 #pragma omp distribute parallel for 8770 for (int i = 0; i < 10; ++i) { 8771 #pragma omp task 8772 { 8773 bar(); 8774 } 8775 } 8776 #pragma omp target 8777 #pragma omp teams 8778 #pragma omp distribute parallel for 8779 for (int i = 0; i < 10; ++i) { 8780 #pragma omp taskyield 8781 bar(); 8782 } 8783 #pragma omp target 8784 #pragma omp teams 8785 #pragma omp distribute parallel for 8786 for (int i = 0; i < 10; ++i) { 8787 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}} 8788 bar(); 8789 } 8790 #pragma omp target 8791 #pragma omp teams 8792 #pragma omp distribute parallel for 8793 for (int i = 0; i < 10; ++i) { 8794 #pragma omp taskwait 8795 bar(); 8796 } 8797 #pragma omp target 8798 #pragma omp teams 8799 #pragma omp distribute parallel for 8800 for (int i = 0; i < 10; ++i) { 8801 #pragma omp flush 8802 bar(); 8803 } 8804 #pragma omp target 8805 #pragma omp teams 8806 #pragma omp distribute parallel for 8807 for (int i = 0; i < 10; ++i) { 8808 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}} 8809 bar(); 8810 } 8811 #pragma omp target 8812 #pragma omp teams 8813 #pragma omp distribute parallel for 8814 for (int i = 0; i < 10; ++i) { 8815 #pragma omp atomic 8816 ++a; 8817 } 8818 #pragma omp target 8819 #pragma omp teams 8820 #pragma omp distribute parallel for 8821 for (int i = 0; i < 10; ++i) { 8822 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}} 8823 ++a; 8824 } 8825 #pragma omp target 8826 #pragma omp teams 8827 #pragma omp distribute parallel for 8828 for (int i = 0; i < 10; ++i) { 8829 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}} 8830 ++a; 8831 } 8832 #pragma omp target 8833 #pragma omp teams 8834 #pragma omp distribute parallel for 8835 for (int i = 0; i < 10; ++i) { 8836 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}} 8837 for (int i = 0; i < 10; ++i) 8838 ; 8839 } 8840 #pragma omp target 8841 #pragma omp teams 8842 #pragma omp distribute parallel for 8843 for (int i = 0; i < 10; ++i) { 8844 #pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}} 8845 ++a; 8846 } 8847 return foo<int>(); 8848 #pragma omp target 8849 #pragma omp teams 8850 #pragma omp distribute parallel for 8851 for (int i = 0; i < 10; ++i) { 8852 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}} 8853 ++a; 8854 } 8855 #pragma omp target 8856 #pragma omp teams 8857 #pragma omp distribute parallel for 8858 for (int i = 0; i < 10; ++i) { 8859 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}} 8860 ++a; 8861 } 8862 #pragma omp target 8863 #pragma omp teams 8864 #pragma omp distribute parallel for 8865 for (int i = 0; i < 10; ++i) { 8866 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}} 8867 ++a; 8868 } 8869 #pragma omp target 8870 #pragma omp teams 8871 #pragma omp distribute parallel for 8872 for (int i = 0; i < 10; ++i) { 8873 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}} 8874 for (int i = 0; i < 10; ++i) 8875 ++a; 8876 } 8877 8878 // DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE 8879 #pragma omp target 8880 #pragma omp teams 8881 #pragma omp distribute parallel for simd 8882 for (int i = 0; i < 10; ++i) { 8883 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8884 for (int i = 0; i < 10; ++i) 8885 ; 8886 } 8887 #pragma omp target 8888 #pragma omp teams 8889 #pragma omp distribute parallel for simd 8890 for (int i = 0; i < 10; ++i) { 8891 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8892 for (int i = 0; i < 10; ++i) 8893 ; 8894 } 8895 #pragma omp target 8896 #pragma omp teams 8897 #pragma omp distribute parallel for simd 8898 for (int i = 0; i < 10; ++i) { 8899 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8900 for (int i = 0; i < 10; ++i) 8901 ; 8902 } 8903 #pragma omp target 8904 #pragma omp teams 8905 #pragma omp distribute parallel for simd 8906 for (int i = 0; i < 10; ++i) { 8907 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 8908 for (int i = 0; i < 10; ++i) 8909 ; 8910 } 8911 #pragma omp target 8912 #pragma omp teams 8913 #pragma omp distribute parallel for simd 8914 for (int i = 0; i < 10; ++i) { 8915 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8916 for (int i = 0; i < 10; ++i) 8917 ; 8918 } 8919 #pragma omp target 8920 #pragma omp teams 8921 #pragma omp distribute parallel for simd 8922 for (int i = 0; i < 10; ++i) { 8923 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8924 for (int i = 0; i < 10; ++i) 8925 ; 8926 } 8927 #pragma omp target 8928 #pragma omp teams 8929 #pragma omp distribute parallel for simd 8930 for (int i = 0; i < 10; ++i) { 8931 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8932 { 8933 bar(); 8934 } 8935 } 8936 #pragma omp target 8937 #pragma omp teams 8938 #pragma omp distribute parallel for simd 8939 for (int i = 0; i < 10; ++i) { 8940 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8941 { 8942 bar(); 8943 } 8944 } 8945 #pragma omp target 8946 #pragma omp teams 8947 #pragma omp distribute parallel for simd 8948 for (int i = 0; i < 10; ++i) { 8949 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8950 { 8951 bar(); 8952 } 8953 } 8954 #pragma omp target 8955 #pragma omp teams 8956 #pragma omp distribute parallel for simd 8957 for (int i = 0; i < 10; ++i) { 8958 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8959 { 8960 bar(); 8961 } 8962 } 8963 #pragma omp target 8964 #pragma omp teams 8965 #pragma omp distribute parallel for simd 8966 for (int i = 0; i < 10; ++i) { 8967 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8968 { 8969 bar(); 8970 } 8971 } 8972 #pragma omp target 8973 #pragma omp teams 8974 #pragma omp distribute parallel for simd 8975 for (int i = 0; i < 10; ++i) { 8976 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8977 { 8978 #pragma omp single 8979 { 8980 bar(); 8981 } 8982 } 8983 } 8984 #pragma omp target 8985 #pragma omp teams 8986 #pragma omp distribute parallel for simd 8987 for (int i = 0; i < 10; ++i) { 8988 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8989 for (int i = 0; i < 10; ++i) 8990 ; 8991 } 8992 #pragma omp target 8993 #pragma omp teams 8994 #pragma omp distribute parallel for simd 8995 for (int i = 0; i < 10; ++i) { 8996 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 8997 for (int i = 0; i < 10; ++i) 8998 ; 8999 } 9000 #pragma omp target 9001 #pragma omp teams 9002 #pragma omp distribute parallel for simd 9003 for (int i = 0; i < 10; ++i) { 9004 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9005 { 9006 bar(); 9007 } 9008 } 9009 #pragma omp target 9010 #pragma omp teams 9011 #pragma omp distribute parallel for simd 9012 for (int i = 0; i < 10; ++i) { 9013 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9014 { 9015 bar(); 9016 } 9017 } 9018 #pragma omp target 9019 #pragma omp teams 9020 #pragma omp distribute parallel for simd 9021 for (int i = 0; i < 10; ++i) { 9022 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9023 bar(); 9024 } 9025 #pragma omp target 9026 #pragma omp teams 9027 #pragma omp distribute parallel for simd 9028 for (int i = 0; i < 10; ++i) { 9029 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9030 bar(); 9031 } 9032 #pragma omp target 9033 #pragma omp teams 9034 #pragma omp distribute parallel for simd 9035 for (int i = 0; i < 10; ++i) { 9036 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9037 bar(); 9038 } 9039 #pragma omp target 9040 #pragma omp teams 9041 #pragma omp distribute parallel for simd 9042 for (int i = 0; i < 10; ++i) { 9043 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9044 bar(); 9045 } 9046 #pragma omp target 9047 #pragma omp teams 9048 #pragma omp distribute parallel for simd 9049 for (int i = 0; i < 10; ++i) { 9050 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9051 bar(); 9052 } 9053 #pragma omp target 9054 #pragma omp teams 9055 #pragma omp distribute parallel for simd 9056 for (int i = 0; i < 10; ++i) { 9057 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9058 ++a; 9059 } 9060 #pragma omp target 9061 #pragma omp teams 9062 #pragma omp distribute parallel for simd 9063 for (int i = 0; i < 10; ++i) { 9064 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9065 ++a; 9066 } 9067 #pragma omp target 9068 #pragma omp teams 9069 #pragma omp distribute parallel for simd 9070 for (int i = 0; i < 10; ++i) { 9071 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9072 ++a; 9073 } 9074 #pragma omp target 9075 #pragma omp teams 9076 #pragma omp distribute parallel for simd 9077 for (int i = 0; i < 10; ++i) { 9078 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9079 ++a; 9080 } 9081 return foo<int>(); 9082 #pragma omp target 9083 #pragma omp teams 9084 #pragma omp distribute parallel for simd 9085 for (int i = 0; i < 10; ++i) { 9086 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9087 ++a; 9088 } 9089 #pragma omp target 9090 #pragma omp teams 9091 #pragma omp distribute parallel for simd 9092 for (int i = 0; i < 10; ++i) { 9093 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9094 ++a; 9095 } 9096 #pragma omp target 9097 #pragma omp teams 9098 #pragma omp distribute parallel for simd 9099 for (int i = 0; i < 10; ++i) { 9100 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9101 ++a; 9102 } 9103 #pragma omp target 9104 #pragma omp teams 9105 #pragma omp distribute parallel for simd 9106 for (int i = 0; i < 10; ++i) { 9107 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9108 for (int i = 0; i < 10; ++i) 9109 ; 9110 } 9111 9112 // DISTRIBUTE SIMD DIRECTIVE 9113 #pragma omp target 9114 #pragma omp teams 9115 #pragma omp distribute simd 9116 for (int i = 0; i < 10; ++i) { 9117 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9118 for (int i = 0; i < 10; ++i) 9119 ; 9120 } 9121 #pragma omp target 9122 #pragma omp teams 9123 #pragma omp distribute simd 9124 for (int i = 0; i < 10; ++i) { 9125 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9126 for (int i = 0; i < 10; ++i) 9127 ; 9128 } 9129 #pragma omp target 9130 #pragma omp teams 9131 #pragma omp distribute simd 9132 for (int i = 0; i < 10; ++i) { 9133 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9134 for (int i = 0; i < 10; ++i) 9135 ; 9136 } 9137 #pragma omp target 9138 #pragma omp teams 9139 #pragma omp distribute simd 9140 for (int i = 0; i < 10; ++i) { 9141 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} 9142 for (int i = 0; i < 10; ++i) 9143 ; 9144 } 9145 #pragma omp target 9146 #pragma omp teams 9147 #pragma omp distribute simd 9148 for (int i = 0; i < 10; ++i) { 9149 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9150 for (int i = 0; i < 10; ++i) 9151 ; 9152 } 9153 #pragma omp target 9154 #pragma omp teams 9155 #pragma omp distribute simd 9156 for (int i = 0; i < 10; ++i) { 9157 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9158 for (int i = 0; i < 10; ++i) 9159 ; 9160 } 9161 #pragma omp target 9162 #pragma omp teams 9163 #pragma omp distribute simd 9164 for (int i = 0; i < 10; ++i) { 9165 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9166 { 9167 bar(); 9168 } 9169 } 9170 #pragma omp target 9171 #pragma omp teams 9172 #pragma omp distribute simd 9173 for (int i = 0; i < 10; ++i) { 9174 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9175 { 9176 bar(); 9177 } 9178 } 9179 #pragma omp target 9180 #pragma omp teams 9181 #pragma omp distribute simd 9182 for (int i = 0; i < 10; ++i) { 9183 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9184 { 9185 bar(); 9186 } 9187 } 9188 #pragma omp target 9189 #pragma omp teams 9190 #pragma omp distribute simd 9191 for (int i = 0; i < 10; ++i) { 9192 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9193 { 9194 bar(); 9195 } 9196 } 9197 #pragma omp target 9198 #pragma omp teams 9199 #pragma omp distribute simd 9200 for (int i = 0; i < 10; ++i) { 9201 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9202 { 9203 bar(); 9204 } 9205 } 9206 #pragma omp target 9207 #pragma omp teams 9208 #pragma omp distribute simd 9209 for (int i = 0; i < 10; ++i) { 9210 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9211 { 9212 #pragma omp single 9213 { 9214 bar(); 9215 } 9216 } 9217 } 9218 #pragma omp target 9219 #pragma omp teams 9220 #pragma omp distribute simd 9221 for (int i = 0; i < 10; ++i) { 9222 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9223 for (int i = 0; i < 10; ++i) 9224 ; 9225 } 9226 #pragma omp target 9227 #pragma omp teams 9228 #pragma omp distribute simd 9229 for (int i = 0; i < 10; ++i) { 9230 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9231 for (int i = 0; i < 10; ++i) 9232 ; 9233 } 9234 #pragma omp target 9235 #pragma omp teams 9236 #pragma omp distribute simd 9237 for (int i = 0; i < 10; ++i) { 9238 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9239 { 9240 bar(); 9241 } 9242 } 9243 #pragma omp target 9244 #pragma omp teams 9245 #pragma omp distribute simd 9246 for (int i = 0; i < 10; ++i) { 9247 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9248 { 9249 bar(); 9250 } 9251 } 9252 #pragma omp target 9253 #pragma omp teams 9254 #pragma omp distribute simd 9255 for (int i = 0; i < 10; ++i) { 9256 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9257 bar(); 9258 } 9259 #pragma omp target 9260 #pragma omp teams 9261 #pragma omp distribute simd 9262 for (int i = 0; i < 10; ++i) { 9263 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9264 bar(); 9265 } 9266 #pragma omp target 9267 #pragma omp teams 9268 #pragma omp distribute simd 9269 for (int i = 0; i < 10; ++i) { 9270 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9271 bar(); 9272 } 9273 #pragma omp target 9274 #pragma omp teams 9275 #pragma omp distribute simd 9276 for (int i = 0; i < 10; ++i) { 9277 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9278 bar(); 9279 } 9280 #pragma omp target 9281 #pragma omp teams 9282 #pragma omp distribute simd 9283 for (int i = 0; i < 10; ++i) { 9284 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9285 bar(); 9286 } 9287 #pragma omp target 9288 #pragma omp teams 9289 #pragma omp distribute simd 9290 for (int i = 0; i < 10; ++i) { 9291 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9292 ++a; 9293 } 9294 #pragma omp target 9295 #pragma omp teams 9296 #pragma omp distribute simd 9297 for (int i = 0; i < 10; ++i) { 9298 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9299 ++a; 9300 } 9301 #pragma omp target 9302 #pragma omp teams 9303 #pragma omp distribute simd 9304 for (int i = 0; i < 10; ++i) { 9305 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9306 ++a; 9307 } 9308 #pragma omp target 9309 #pragma omp teams 9310 #pragma omp distribute simd 9311 for (int i = 0; i < 10; ++i) { 9312 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9313 ++a; 9314 } 9315 return foo<int>(); 9316 #pragma omp target 9317 #pragma omp teams 9318 #pragma omp distribute simd 9319 for (int i = 0; i < 10; ++i) { 9320 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9321 ++a; 9322 } 9323 #pragma omp target 9324 #pragma omp teams 9325 #pragma omp distribute simd 9326 for (int i = 0; i < 10; ++i) { 9327 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9328 ++a; 9329 } 9330 #pragma omp target 9331 #pragma omp teams 9332 #pragma omp distribute simd 9333 for (int i = 0; i < 10; ++i) { 9334 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9335 ++a; 9336 } 9337 #pragma omp target 9338 #pragma omp teams 9339 #pragma omp distribute simd 9340 for (int i = 0; i < 10; ++i) { 9341 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}} 9342 for (int i = 0; i < 10; ++i) 9343 ; 9344 } 9345 } 9346