From 2a43a1610db335afcccd1a179a33a0886a5a2c4d Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Thu, 26 Mar 2020 17:12:45 -0400 Subject: [PATCH] [OPENMP50]Fix the checks for the nesting of scan directives. Fixed the check for the orhaned scan directives and improved checks for parallel for and parallel for simd directives. --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 5 +- clang/lib/Sema/SemaOpenMP.cpp | 5 +- clang/test/OpenMP/nesting_of_regions.cpp | 78 ++++++++++++------------ clang/test/OpenMP/scan_messages.cpp | 20 +++--- 4 files changed, 55 insertions(+), 53 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 05645c4..5605200 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -9863,7 +9863,7 @@ def err_omp_prohibited_region : Error< "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|" "; perhaps you forget to enclose 'omp %3' directive into a target region?|" "; perhaps you forget to enclose 'omp %3' directive into a teams region?|" - "; perhaps you forget to enclose 'omp %3' directive into a for, simd, or for simd region?}2">; + "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">; def err_omp_prohibited_region_simd : Error< "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">; def err_omp_prohibited_region_atomic : Error< @@ -10060,7 +10060,8 @@ def warn_omp_nesting_simd : Warning< InGroup; def err_omp_orphaned_device_directive : Error< "orphaned 'omp %0' directives are prohibited" - "; perhaps you forget to enclose the directive into a %select{|||target |teams|for, simd, or for simd }1region?">; + "; perhaps you forget to enclose the directive into a " + "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">; def err_omp_reduction_non_addressable_expression : Error< "expected addressable reduction item for the task-based directives">; def err_omp_reduction_with_nogroup : Error< diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 11cc43a..31921ea 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -4177,7 +4177,7 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack, if (ParentRegion == OMPD_unknown && !isOpenMPNestingTeamsDirective(CurrentRegion) && CurrentRegion != OMPD_cancellation_point && - CurrentRegion != OMPD_cancel) + CurrentRegion != OMPD_cancel && CurrentRegion != OMPD_scan) return false; if (CurrentRegion == OMPD_cancellation_point || CurrentRegion == OMPD_cancel) { @@ -4298,7 +4298,8 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack, NestingProhibited = SemaRef.LangOpts.OpenMP < 50 || (ParentRegion != OMPD_simd && ParentRegion != OMPD_for && - ParentRegion != OMPD_for_simd); + ParentRegion != OMPD_for_simd && ParentRegion != OMPD_parallel_for && + ParentRegion != OMPD_parallel_for_simd); OrphanSeen = ParentRegion == OMPD_unknown; Recommend = ShouldBeInLoopSimdRegion; } diff --git a/clang/test/OpenMP/nesting_of_regions.cpp b/clang/test/OpenMP/nesting_of_regions.cpp index d987d84..4bfaf3f 100644 --- a/clang/test/OpenMP/nesting_of_regions.cpp +++ b/clang/test/OpenMP/nesting_of_regions.cpp @@ -84,7 +84,7 @@ void foo() { } #pragma omp parallel { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp parallel @@ -618,7 +618,7 @@ void foo() { } #pragma omp for for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} +#pragma omp scan // omp45-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} bar(); } #pragma omp for @@ -2618,7 +2618,7 @@ void foo() { } #pragma omp parallel for for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'parallel for' region}} +#pragma omp scan // omp45-error {{region cannot be closely nested inside 'parallel for' region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} bar(); } #pragma omp parallel for @@ -2892,7 +2892,7 @@ void foo() { } #pragma omp parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} bar(); } #pragma omp parallel for simd @@ -4489,7 +4489,7 @@ void foo() { } #pragma omp target { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -4728,7 +4728,7 @@ void foo() { } #pragma omp target parallel { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target parallel @@ -5240,7 +5240,7 @@ void foo() { #pragma omp target #pragma omp teams { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -5872,7 +5872,7 @@ void foo() { #pragma omp teams #pragma omp distribute for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -6510,7 +6510,7 @@ void foo() { #pragma omp teams #pragma omp distribute parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -6799,7 +6799,7 @@ void foo() { } #pragma omp target simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target simd @@ -7049,7 +7049,7 @@ void foo() { #pragma omp target #pragma omp teams distribute for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -7318,7 +7318,7 @@ void foo() { #pragma omp target #pragma omp teams distribute for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -7607,7 +7607,7 @@ void foo() { #pragma omp target #pragma omp teams distribute simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'teams distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'teams distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -7896,7 +7896,7 @@ void foo() { #pragma omp target #pragma omp teams distribute parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'teams distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'teams distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -8402,7 +8402,7 @@ void foo() { } #pragma omp target teams { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target teams @@ -8681,7 +8681,7 @@ void foo() { } #pragma omp target teams distribute for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target teams distribute @@ -9177,7 +9177,7 @@ void foo() { } #pragma omp target teams distribute parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target teams distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target teams distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target teams distribute parallel for simd @@ -9197,7 +9197,7 @@ void foo() { } #pragma omp target teams distribute parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}OK +#pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}} ++a; } #pragma omp target teams distribute parallel for simd @@ -9425,7 +9425,7 @@ void foo() { } #pragma omp target teams distribute simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target teams distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target teams distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target teams distribute simd @@ -9445,7 +9445,7 @@ void foo() { } #pragma omp target teams distribute simd for (int i = 0; i < 10; ++i) { -#pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}OK +#pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}} ++a; } #pragma omp target teams distribute simd @@ -9623,7 +9623,7 @@ void foo() { } #pragma omp parallel { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp parallel @@ -12035,7 +12035,7 @@ void foo() { } #pragma omp parallel for for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'parallel for' region}} +#pragma omp scan // omp45-error {{region cannot be closely nested inside 'parallel for' region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} bar(); } #pragma omp parallel for @@ -12310,7 +12310,7 @@ void foo() { } #pragma omp parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} bar(); } #pragma omp parallel for simd @@ -13331,7 +13331,7 @@ void foo() { } #pragma omp target { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -13561,7 +13561,7 @@ void foo() { } #pragma omp target parallel { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target parallel @@ -14072,7 +14072,7 @@ void foo() { #pragma omp target #pragma omp teams { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -14678,7 +14678,7 @@ void foo() { #pragma omp teams #pragma omp distribute for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -15334,7 +15334,7 @@ void foo() { #pragma omp teams #pragma omp distribute parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -15653,7 +15653,7 @@ void foo() { #pragma omp teams #pragma omp distribute simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -15934,7 +15934,7 @@ void foo() { } #pragma omp target simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target simd @@ -16195,7 +16195,7 @@ void foo() { #pragma omp target #pragma omp teams distribute for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -16484,7 +16484,7 @@ void foo() { #pragma omp target #pragma omp teams distribute simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'teams distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'teams distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -16773,7 +16773,7 @@ void foo() { #pragma omp target #pragma omp teams distribute parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'teams distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'teams distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target @@ -17279,7 +17279,7 @@ void foo() { } #pragma omp target teams { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target teams @@ -17558,7 +17558,7 @@ void foo() { } #pragma omp target teams distribute for (int i = 0; i < 10; ++i) { -#pragma omp scan // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target teams distribute @@ -18054,7 +18054,7 @@ void foo() { } #pragma omp target teams distribute parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target teams distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target teams distribute parallel for simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target teams distribute parallel for simd @@ -18074,7 +18074,7 @@ void foo() { } #pragma omp target teams distribute parallel for simd for (int i = 0; i < 10; ++i) { -#pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}OK +#pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}} ++a; } #pragma omp target teams distribute parallel for simd @@ -18302,7 +18302,7 @@ void foo() { } #pragma omp target teams distribute simd for (int i = 0; i < 10; ++i) { -#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target teams distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} +#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{region cannot be closely nested inside 'target teams distribute simd' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, for simd, parallel for, or parallel for simd region?}} bar(); } #pragma omp target teams distribute simd @@ -18322,7 +18322,7 @@ void foo() { } #pragma omp target teams distribute simd for (int i = 0; i < 10; ++i) { -#pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}OK +#pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}} ++a; } #pragma omp target teams distribute simd diff --git a/clang/test/OpenMP/scan_messages.cpp b/clang/test/OpenMP/scan_messages.cpp index 9f09385..c72897e 100644 --- a/clang/test/OpenMP/scan_messages.cpp +++ b/clang/test/OpenMP/scan_messages.cpp @@ -20,14 +20,14 @@ T tmain(T argc) { if (argc) #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} if (argc) { -#pragma omp scan inclusive(argc) +#pragma omp scan inclusive(argc) // expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} } #pragma omp simd for (int i = 0; i < 10; ++i) while (argc) #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} while (argc) { -#pragma omp scan inclusive(argc) +#pragma omp scan inclusive(argc) // expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} } #pragma omp simd for (int i = 0; i < 10; ++i) @@ -46,10 +46,10 @@ T tmain(T argc) { #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} +#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} switch (argc) case 1: { -#pragma omp scan inclusive(argc) +#pragma omp scan inclusive(argc) // expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} } #pragma omp simd for (int i = 0; i < 10; ++i) @@ -67,7 +67,7 @@ T tmain(T argc) { for (;;) #pragma omp scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} for (;;) { -#pragma omp scan exclusive(argc) +#pragma omp scan exclusive(argc) // expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} } #pragma omp simd for (int i = 0; i < 10; ++i) { @@ -109,14 +109,14 @@ int main(int argc, char **argv) { if (argc) #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} if (argc) { -#pragma omp scan inclusive(argc) +#pragma omp scan inclusive(argc) // expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} } #pragma omp simd for (int i = 0; i < 10; ++i) while (argc) #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} while (argc) { -#pragma omp scan inclusive(argc) +#pragma omp scan inclusive(argc) // expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} } #pragma omp simd for (int i = 0; i < 10; ++i) @@ -135,10 +135,10 @@ int main(int argc, char **argv) { #pragma omp scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} +#pragma omp scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} switch (argc) case 1: { -#pragma omp scan exclusive(argc) +#pragma omp scan exclusive(argc) // expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} } #pragma omp simd for (int i = 0; i < 10; ++i) @@ -156,7 +156,7 @@ int main(int argc, char **argv) { for (;;) #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} for (;;) { -#pragma omp scan inclusive(argc) +#pragma omp scan inclusive(argc) // expected-error {{orphaned 'omp scan' directives are prohibited; perhaps you forget to enclose the directive into a for, simd, for simd, parallel for, or parallel for simd region?}} } #pragma omp simd for (int i = 0; i < 10; ++i) { -- 2.7.4