From f9e71f4d9d39871390da48207d7fd6b116e370dc Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Thu, 26 Mar 2020 15:47:50 -0400 Subject: [PATCH] Revert "[OPENMP50]Add basic support for inscan reduction modifier." This reverts commit 8099e0fe82ce78c15bc6c4cf52caca5b6fbe28f5 to fix the problems with the Windows-based buildbots. --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 18 +-- clang/include/clang/Basic/OpenMPKinds.def | 1 - clang/lib/Sema/SemaOpenMP.cpp | 147 ++------------------- clang/test/OpenMP/nesting_of_regions.cpp | 70 +++++----- .../OpenMP/parallel_for_reduction_messages.cpp | 36 +---- clang/test/OpenMP/parallel_reduction_messages.c | 4 +- clang/test/OpenMP/scan_ast_print.cpp | 14 +- clang/test/OpenMP/scan_messages.cpp | 72 +++++----- 8 files changed, 98 insertions(+), 264 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index a71749c..05645c4 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, for simd, parallel for, or parallel for simd region?}2">; + "; perhaps you forget to enclose 'omp %3' directive into a for, simd, or 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,8 +10060,7 @@ 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, for simd, parallel for, or parallel for simd }1region?">; + "; perhaps you forget to enclose the directive into a %select{|||target |teams|for, simd, or 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< @@ -10101,19 +10100,6 @@ def err_omp_depobj_single_clause_expected : Error< "exactly one of 'depend', 'destroy', or 'update' clauses is expected">; def err_omp_scan_single_clause_expected : Error< "exactly one of 'inclusive' or 'exclusive' clauses is expected">; -def err_omp_inclusive_exclusive_not_reduction : Error< - "the list item must appear in 'reduction' clause with the 'inscan' modifier " - "of the parent directive">; -def err_omp_reduction_not_inclusive_exclusive : Error< - "the inscan reduction list item must appear as a list item in an 'inclusive' or" - " 'exclusive' clause on an inner 'omp scan' directive">; -def err_omp_wrong_inscan_reduction : Error< - "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd'," - " 'omp parallel for', or 'omp parallel for simd' directive">; -def err_omp_inscan_reduction_expected : Error< - "expected 'reduction' clause with the 'inscan' modifier">; -def note_omp_previous_inscan_reduction : Note< - "'reduction' clause with 'inscan' modifier is used here">; def err_omp_expected_predefined_allocator : Error< "expected one of the predefined allocators for the variables with the static " "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', " diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def index 3cf92ea..bfb41ab 100644 --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -1112,7 +1112,6 @@ OPENMP_DEPOBJ_CLAUSE(update) // Modifiers for 'reduction' clause. OPENMP_REDUCTION_MODIFIER(default) -OPENMP_REDUCTION_MODIFIER(inscan) #undef OPENMP_REDUCTION_MODIFIER #undef OPENMP_SCAN_CLAUSE diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index d0c304d..11cc43a 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -62,15 +62,14 @@ public: struct DSAVarData { OpenMPDirectiveKind DKind = OMPD_unknown; OpenMPClauseKind CKind = OMPC_unknown; - unsigned Modifier = 0; const Expr *RefExpr = nullptr; DeclRefExpr *PrivateCopy = nullptr; SourceLocation ImplicitDSALoc; DSAVarData() = default; DSAVarData(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind, const Expr *RefExpr, DeclRefExpr *PrivateCopy, - SourceLocation ImplicitDSALoc, unsigned Modifier) - : DKind(DKind), CKind(CKind), Modifier(Modifier), RefExpr(RefExpr), + SourceLocation ImplicitDSALoc) + : DKind(DKind), CKind(CKind), RefExpr(RefExpr), PrivateCopy(PrivateCopy), ImplicitDSALoc(ImplicitDSALoc) {} }; using OperatorOffsetTy = @@ -81,7 +80,6 @@ public: private: struct DSAInfo { OpenMPClauseKind Attributes = OMPC_unknown; - unsigned Modifier = 0; /// Pointer to a reference expression and a flag which shows that the /// variable is marked as lastprivate(true) or not (false). llvm::PointerIntPair RefExpr; @@ -166,8 +164,6 @@ private: /// List of globals marked as declare target link in this target region /// (isOpenMPTargetExecutionDirective(Directive) == true). llvm::SmallVector DeclareTargetLinkVarDecls; - /// List of decls used in inclusive/exclusive clauses of the scan directive. - llvm::DenseSet> UsedInScanDirective; SharingMapTy(OpenMPDirectiveKind DKind, DeclarationNameInfo Name, Scope *CurScope, SourceLocation Loc) : Directive(DKind), DirectiveName(Name), CurScope(CurScope), @@ -473,21 +469,9 @@ public: /// parent directive. const ValueDecl *getParentLoopControlVariable(unsigned I) const; - /// Marks the specified decl \p D as used in scan directive. - void markDeclAsUsedInScanDirective(ValueDecl *D) { - SharingMapTy *Stack = getSecondOnStackOrNull(); - Stack->UsedInScanDirective.insert(D); - } - - /// Checks if the specified declaration was used in the inner scan directive. - bool isUsedInScanDirective(ValueDecl *D) const { - const SharingMapTy &Stack = getTopOfStack(); - return Stack.UsedInScanDirective.count(D) > 0; - } - /// Adds explicit data sharing attribute to the specified declaration. void addDSA(const ValueDecl *D, const Expr *E, OpenMPClauseKind A, - DeclRefExpr *PrivateCopy = nullptr, unsigned Modifier = 0); + DeclRefExpr *PrivateCopy = nullptr); /// Adds additional information for the reduction items with the reduction id /// represented as an operator. @@ -1095,7 +1079,6 @@ DSAStackTy::DSAVarData DSAStackTy::getDSA(const_iterator &Iter, DVar.PrivateCopy = Data.PrivateCopy; DVar.CKind = Data.Attributes; DVar.ImplicitDSALoc = Iter->DefaultAttrLoc; - DVar.Modifier = Data.Modifier; return DVar; } @@ -1243,21 +1226,19 @@ const ValueDecl *DSAStackTy::getParentLoopControlVariable(unsigned I) const { } void DSAStackTy::addDSA(const ValueDecl *D, const Expr *E, OpenMPClauseKind A, - DeclRefExpr *PrivateCopy, unsigned Modifier) { + DeclRefExpr *PrivateCopy) { D = getCanonicalDecl(D); if (A == OMPC_threadprivate) { DSAInfo &Data = Threadprivates[D]; Data.Attributes = A; Data.RefExpr.setPointer(E); Data.PrivateCopy = nullptr; - Data.Modifier = Modifier; } else { DSAInfo &Data = getTopOfStack().SharingMap[D]; assert(Data.Attributes == OMPC_unknown || (A == Data.Attributes) || (A == OMPC_firstprivate && Data.Attributes == OMPC_lastprivate) || (A == OMPC_lastprivate && Data.Attributes == OMPC_firstprivate) || (isLoopControlVariable(D).first && A == OMPC_private)); - Data.Modifier = Modifier; if (A == OMPC_lastprivate && Data.Attributes == OMPC_firstprivate) { Data.RefExpr.setInt(/*IntVal=*/true); return; @@ -1269,7 +1250,6 @@ void DSAStackTy::addDSA(const ValueDecl *D, const Expr *E, OpenMPClauseKind A, Data.PrivateCopy = PrivateCopy; if (PrivateCopy) { DSAInfo &Data = getTopOfStack().SharingMap[PrivateCopy->getDecl()]; - Data.Modifier = Modifier; Data.Attributes = A; Data.RefExpr.setPointerAndInt(PrivateCopy, IsLastprivate); Data.PrivateCopy = nullptr; @@ -1375,7 +1355,7 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopMostTaskgroupReductionData( "set."); TaskgroupDescriptor = I->TaskgroupReductionRef; return DSAVarData(OMPD_taskgroup, OMPC_reduction, Data.RefExpr.getPointer(), - Data.PrivateCopy, I->DefaultAttrLoc, /*Modifier=*/0); + Data.PrivateCopy, I->DefaultAttrLoc); } return DSAVarData(); } @@ -1400,7 +1380,7 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopMostTaskgroupReductionData( "set."); TaskgroupDescriptor = I->TaskgroupReductionRef; return DSAVarData(OMPD_taskgroup, OMPC_reduction, Data.RefExpr.getPointer(), - Data.PrivateCopy, I->DefaultAttrLoc, /*Modifier=*/0); + Data.PrivateCopy, I->DefaultAttrLoc); } return DSAVarData(); } @@ -1475,7 +1455,6 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopDSA(ValueDecl *D, if (TI != Threadprivates.end()) { DVar.RefExpr = TI->getSecond().RefExpr.getPointer(); DVar.CKind = OMPC_threadprivate; - DVar.Modifier = TI->getSecond().Modifier; return DVar; } if (VD && VD->hasAttr()) { @@ -1567,7 +1546,6 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopDSA(ValueDecl *D, DVar.CKind = Data.Attributes; DVar.ImplicitDSALoc = I->DefaultAttrLoc; DVar.DKind = I->Directive; - DVar.Modifier = Data.Modifier; return DVar; } @@ -1614,7 +1592,6 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopDSA(ValueDecl *D, DVar.CKind = Data.Attributes; DVar.ImplicitDSALoc = I->DefaultAttrLoc; DVar.DKind = I->Directive; - DVar.Modifier = Data.Modifier; } return DVar; @@ -2322,64 +2299,11 @@ void Sema::EndOpenMPClause() { DSAStack->setClauseParsingMode(/*K=*/OMPC_unknown); } +static void checkAllocateClauses(Sema &S, DSAStackTy *Stack, + ArrayRef Clauses); static std::pair getPrivateItem(Sema &S, Expr *&RefExpr, SourceLocation &ELoc, SourceRange &ERange, bool AllowArraySection = false); - -/// Check consistency of the reduction clauses. -static void checkReductionClauses(Sema &S, DSAStackTy *Stack, - ArrayRef Clauses) { - bool InscanFound = false; - SourceLocation InscanLoc; - // OpenMP 5.0, 2.19.5.4 reduction Clause, Restrictions. - // A reduction clause without the inscan reduction-modifier may not appear on - // a construct on which a reduction clause with the inscan reduction-modifier - // appears. - for (OMPClause *C : Clauses) { - if (C->getClauseKind() != OMPC_reduction) - continue; - auto *RC = cast(C); - if (RC->getModifier() == OMPC_REDUCTION_inscan) { - InscanFound = true; - InscanLoc = RC->getModifierLoc(); - break; - } - } - if (InscanFound) { - for (OMPClause *C : Clauses) { - if (C->getClauseKind() != OMPC_reduction) - continue; - auto *RC = cast(C); - if (RC->getModifier() != OMPC_REDUCTION_inscan) { - S.Diag(RC->getModifier() == OMPC_REDUCTION_unknown - ? RC->getBeginLoc() - : RC->getModifierLoc(), - diag::err_omp_inscan_reduction_expected); - S.Diag(InscanLoc, diag::note_omp_previous_inscan_reduction); - continue; - } - for (Expr *Ref : RC->varlists()) { - assert(Ref && "NULL expr in OpenMP nontemporal clause."); - SourceLocation ELoc; - SourceRange ERange; - Expr *SimpleRefExpr = Ref; - auto Res = getPrivateItem(S, SimpleRefExpr, ELoc, ERange, - /*AllowArraySection=*/true); - ValueDecl *D = Res.first; - if (!D) - continue; - if (!Stack->isUsedInScanDirective(getCanonicalDecl(D))) { - S.Diag(Ref->getExprLoc(), - diag::err_omp_reduction_not_inclusive_exclusive) - << Ref->getSourceRange(); - } - } - } - } -} - -static void checkAllocateClauses(Sema &S, DSAStackTy *Stack, - ArrayRef Clauses); static DeclRefExpr *buildCapture(Sema &S, ValueDecl *D, Expr *CaptureExpr, bool WithInit); @@ -2456,7 +2380,6 @@ void Sema::EndOpenMPDSABlock(Stmt *CurDirective) { // Check allocate clauses. if (!CurContext->isDependentContext()) checkAllocateClauses(*this, DSAStack, D->clauses()); - checkReductionClauses(*this, DSAStack, D->clauses()); } DSAStack->pop(); @@ -4254,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_scan) + CurrentRegion != OMPD_cancel) return false; if (CurrentRegion == OMPD_cancellation_point || CurrentRegion == OMPD_cancel) { @@ -4375,8 +4298,7 @@ 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_parallel_for && - ParentRegion != OMPD_parallel_for_simd); + ParentRegion != OMPD_for_simd); OrphanSeen = ParentRegion == OMPD_unknown; Recommend = ShouldBeInLoopSimdRegion; } @@ -14049,11 +13971,9 @@ struct ReductionData { SmallVector ExprCaptures; /// List of postupdate expressions. SmallVector ExprPostUpdates; - /// Reduction modifier. - unsigned RedModifier = 0; ReductionData() = delete; /// Reserves required memory for the reduction data. - ReductionData(unsigned Size, unsigned Modifier = 0) : RedModifier(Modifier) { + ReductionData(unsigned Size) { Vars.reserve(Size); Privates.reserve(Size); LHSs.reserve(Size); @@ -14771,8 +14691,7 @@ static bool actOnOMPReductionKindClause( } // All reduction items are still marked as reduction (to do not increase // code base size). - Stack->addDSA(D, RefExpr->IgnoreParens(), OMPC_reduction, Ref, - RD.RedModifier); + Stack->addDSA(D, RefExpr->IgnoreParens(), OMPC_reduction, Ref); if (CurrDir == OMPD_taskgroup) { if (DeclareReductionRef.isUsable()) Stack->addTaskgroupReductionData(D, ReductionIdRange, @@ -14799,22 +14718,8 @@ OMPClause *Sema::ActOnOpenMPReductionClause( << getOpenMPClauseName(OMPC_reduction); return nullptr; } - // OpenMP 5.0, 2.19.5.4 reduction Clause, Restrictions - // A reduction clause with the inscan reduction-modifier may only appear on a - // worksharing-loop construct, a worksharing-loop SIMD construct, a simd - // construct, a parallel worksharing-loop construct or a parallel - // worksharing-loop SIMD construct. - if (Modifier == OMPC_REDUCTION_inscan && - (DSAStack->getCurrentDirective() != OMPD_for && - DSAStack->getCurrentDirective() != OMPD_for_simd && - DSAStack->getCurrentDirective() != OMPD_simd && - DSAStack->getCurrentDirective() != OMPD_parallel_for && - DSAStack->getCurrentDirective() != OMPD_parallel_for_simd)) { - Diag(ModifierLoc, diag::err_omp_wrong_inscan_reduction); - return nullptr; - } - ReductionData RD(VarList.size(), Modifier); + ReductionData RD(VarList.size()); if (actOnOMPReductionKindClause(*this, DSAStack, OMPC_reduction, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, ReductionIdScopeSpec, ReductionId, @@ -18116,19 +18021,6 @@ OMPClause *Sema::ActOnOpenMPInclusiveClause(ArrayRef VarList, if (!D) continue; - const DSAStackTy::DSAVarData DVar = - DSAStack->getTopDSA(D, /*FromParent=*/true); - // OpenMP 5.0, 2.9.6, scan Directive, Restrictions. - // A list item that appears in the inclusive or exclusive clause must appear - // in a reduction clause with the inscan modifier on the enclosing - // worksharing-loop, worksharing-loop SIMD, or simd construct. - if (DVar.CKind != OMPC_reduction || - DVar.Modifier != OMPC_REDUCTION_inscan) - Diag(ELoc, diag::err_omp_inclusive_exclusive_not_reduction) - << RefExpr->getSourceRange(); - - if (DSAStack->getParentDirective() != OMPD_unknown) - DSAStack->markDeclAsUsedInScanDirective(D); Vars.push_back(RefExpr); } @@ -18157,19 +18049,6 @@ OMPClause *Sema::ActOnOpenMPExclusiveClause(ArrayRef VarList, if (!D) continue; - const DSAStackTy::DSAVarData DVar = - DSAStack->getTopDSA(D, /*FromParent=*/true); - // OpenMP 5.0, 2.9.6, scan Directive, Restrictions. - // A list item that appears in the inclusive or exclusive clause must appear - // in a reduction clause with the inscan modifier on the enclosing - // worksharing-loop, worksharing-loop SIMD, or simd construct. - if (DVar.CKind != OMPC_reduction || - DVar.Modifier != OMPC_REDUCTION_inscan) - Diag(ELoc, diag::err_omp_inclusive_exclusive_not_reduction) - << RefExpr->getSourceRange(); - - if (DSAStack->getParentDirective() != OMPD_unknown) - DSAStack->markDeclAsUsedInScanDirective(D); Vars.push_back(RefExpr); } diff --git a/clang/test/OpenMP/nesting_of_regions.cpp b/clang/test/OpenMP/nesting_of_regions.cpp index 0426511..d987d84 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, for simd, parallel for, or parallel 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, or 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 // omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} 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?}} +#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}} bar(); } #pragma omp for @@ -2618,7 +2618,7 @@ void foo() { } #pragma omp parallel for for (int i = 0; i < 10; ++i) { -#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}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'parallel for' region}} 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 {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} +#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?}} 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or for simd region?}} bar(); } #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, for simd, parallel for, or parallel 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, or for simd region?}} bar(); } #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, for simd, parallel for, or parallel 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, or 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 // omp45-error {{region cannot be closely nested inside 'parallel for' region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} +#pragma omp scan // expected-error {{region cannot be closely nested inside 'parallel for' region}} 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 {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} +#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?}} 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or 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, for simd, parallel for, or parallel 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, or for simd region?}} bar(); } #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, for simd, parallel for, or parallel 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, or for simd region?}} bar(); } #pragma omp target teams distribute simd diff --git a/clang/test/OpenMP/parallel_for_reduction_messages.cpp b/clang/test/OpenMP/parallel_for_reduction_messages.cpp index 50a9312..b28fe6c 100644 --- a/clang/test/OpenMP/parallel_for_reduction_messages.cpp +++ b/clang/test/OpenMP/parallel_for_reduction_messages.cpp @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ferror-limit 150 -o - %s -Wuninitialized -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 150 -o - %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized -// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ferror-limit 150 -o - %s -Wuninitialized -// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized -// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 150 -o - %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized extern int omp_default_mem_alloc; void xxx(int argc) { @@ -78,14 +78,6 @@ public: #pragma omp for reduction(+:a) // expected-error {{reduction variable must be shared}} for (int i = 0; i < 10; ++i) ::foo(); -#pragma omp parallel for reduction(inscan, +:a) - for (int i = 0; i < 10; ++i) { -#pragma omp scan inclusive(a) - } -#pragma omp parallel for reduction(inscan, +:a) - for (int i = 0; i < 10; ++i) { -#pragma omp scan exclusive(a) - } } }; class S6 { // expected-note 3 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} @@ -341,21 +333,5 @@ int main(int argc, char **argv) { for (int i = 0; i < 10; ++i) m++; -#pragma omp parallel for reduction(inscan, + : m) reduction(*: fl) reduction(default, &&: j) // expected-error 2 {{expected 'reduction' clause with the 'inscan' modifier}} expected-note 2 {{'reduction' clause with 'inscan' modifier is used here}} - for (int i = 0; i < 10; ++i) { -#pragma omp scan exclusive(m) - m++; - } -#pragma omp parallel for reduction(inscan, + : m, fl, j) // expected-error 2 {{the inscan reduction list item must appear as a list item in an 'inclusive' or 'exclusive' clause on an inner 'omp scan' directive}} - for (int i = 0; i < 10; ++i) { -#pragma omp scan exclusive(m) - m++; - } -#pragma omp parallel for reduction(inscan, + : m, fl, j) // expected-error 2 {{the inscan reduction list item must appear as a list item in an 'inclusive' or 'exclusive' clause on an inner 'omp scan' directive}} - for (int i = 0; i < 10; ++i) { -#pragma omp scan inclusive(m) - m++; - } - return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain' requested here}} expected-note {{in instantiation of function template specialization 'tmain' requested here}} } diff --git a/clang/test/OpenMP/parallel_reduction_messages.c b/clang/test/OpenMP/parallel_reduction_messages.c index b5e6667..61a3e93 100644 --- a/clang/test/OpenMP/parallel_reduction_messages.c +++ b/clang/test/OpenMP/parallel_reduction_messages.c @@ -10,12 +10,10 @@ void test() { ; #pragma omp parallel reduction(default, // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-note {{to match this '('}} ; -#pragma omp parallel reduction(unknown, +: a) // expected-error {{expected 'default' or 'inscan' in OpenMP clause 'reduction'}} +#pragma omp parallel reduction(unknown, +: a) // expected-error {{expected 'default' in OpenMP clause 'reduction'}} ; #pragma omp parallel reduction(default, + : a) ; -#pragma omp parallel reduction(inscan, + : a) // expected-error {{'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd', 'omp parallel for', or 'omp parallel for simd' directive}} - ; #pragma omp parallel reduction(+ : incomplete) // expected-error {{a reduction list item with incomplete type 'int []'}} ; } diff --git a/clang/test/OpenMP/scan_ast_print.cpp b/clang/test/OpenMP/scan_ast_print.cpp index 0bee5d9..4b9eca6 100644 --- a/clang/test/OpenMP/scan_ast_print.cpp +++ b/clang/test/OpenMP/scan_ast_print.cpp @@ -15,35 +15,33 @@ void foo() {} template T tmain(T argc) { static T a; -#pragma omp for reduction(inscan, +: a) +#pragma omp for for (int i = 0; i < 10; ++i) { #pragma omp scan inclusive(a) } return a + argc; } // CHECK: static T a; -// CHECK-NEXT: #pragma omp for reduction(inscan, +: a) +// CHECK-NEXT: #pragma omp for // CHECK-NEXT: for (int i = 0; i < 10; ++i) { // CHECK-NEXT: #pragma omp scan inclusive(a){{$}} // CHECK: static int a; -// CHECK-NEXT: #pragma omp for reduction(inscan, +: a) +// CHECK-NEXT: #pragma omp for // CHECK-NEXT: for (int i = 0; i < 10; ++i) { // CHECK-NEXT: #pragma omp scan inclusive(a) // CHECK: static char a; -// CHECK-NEXT: #pragma omp for reduction(inscan, +: a) +// CHECK-NEXT: #pragma omp for // CHECK-NEXT: for (int i = 0; i < 10; ++i) { // CHECK-NEXT: #pragma omp scan inclusive(a) int main(int argc, char **argv) { static int a; // CHECK: static int a; -#pragma omp parallel -#pragma omp for simd reduction(inscan, ^: a, argc) +#pragma omp for simd for (int i = 0; i < 10; ++i) { #pragma omp scan exclusive(a, argc) } -// CHECK-NEXT: #pragma omp parallel -// CHECK-NEXT: #pragma omp for simd reduction(inscan, ^: a,argc) +// CHECK-NEXT: #pragma omp for simd // CHECK-NEXT: for (int i = 0; i < 10; ++i) { // CHECK-NEXT: #pragma omp scan exclusive(a,argc){{$}} return tmain(argc) + tmain(argv[0][0]) + a; diff --git a/clang/test/OpenMP/scan_messages.cpp b/clang/test/OpenMP/scan_messages.cpp index 38c6d33..9f09385 100644 --- a/clang/test/OpenMP/scan_messages.cpp +++ b/clang/test/OpenMP/scan_messages.cpp @@ -3,8 +3,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 %s template -T tmain() { - static T argc; +T tmain(T argc) { #pragma omp for for (int i = 0; i < 10; ++i) { #pragma omp scan // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} @@ -16,43 +15,43 @@ T tmain() { #pragma omp scan untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp scan'}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} #pragma omp scan unknown // expected-warning {{extra tokens at the end of '#pragma omp scan' are ignored}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} } -#pragma omp for simd reduction(inscan, +: argc) +#pragma omp for simd for (int i = 0; i < 10; ++i) if (argc) #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} if (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 scan inclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#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) // 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 scan inclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) do #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} while (argc) ; -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) do { #pragma omp scan inclusive(argc) } while (argc); -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) switch (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 {{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?}} 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}} switch (argc) case 1: { -#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 scan inclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) switch (argc) { #pragma omp scan exclusive(argc) // expected-note 2 {{previous 'scan' directive used here}} @@ -63,19 +62,19 @@ T tmain() { #pragma omp scan exclusive(argc) // expected-error {{exactly one 'scan' directive must appear in the loop body of an enclosing directive}} } break; } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) for (;;) #pragma omp scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} for (;;) { -#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 scan exclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) { label: #pragma omp scan exclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) { label1 : { #pragma omp scan inclusive(argc) @@ -84,65 +83,64 @@ label1 : { return T(); } -int main() { - static int argc; -#pragma omp simd reduction(inscan, +: argc) +int main(int argc, char **argv) { +#pragma omp simd for (int i = 0; i < 10; ++i) { #pragma omp scan inclusive(argc) inclusive(argc) // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} ; } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) { #pragma omp scan exclusive(argc) inclusive(argc) // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} ; } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) { #pragma omp scan exclusive(argc) exclusive(argc) // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} ; } -#pragma omp simd reduction(inscan, +: argc) // expected-error {{the inscan reduction list item must appear as a list item in an 'inclusive' or 'exclusive' clause on an inner 'omp scan' directive}} +#pragma omp simd for (int i = 0; i < 10; ++i) { #pragma omp scan untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp scan'}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} #pragma omp scan unknown // expected-warning {{extra tokens at the end of '#pragma omp scan' are ignored}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}} } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) if (argc) #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} if (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?}} expected-error {{the list item must appear in 'reduction' clause with the 'inscan' modifier of the parent directive}} +#pragma omp scan inclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#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) // expected-error {{the list item must appear in 'reduction' clause with the 'inscan' modifier of the parent directive}} 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 scan inclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) do #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} while (argc) ; -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) do { #pragma omp scan exclusive(argc) } while (argc); -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) switch (argc) #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}} expected-error {{the list item must appear in 'reduction' clause with the 'inscan' modifier of the parent directive}} 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 scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} switch (argc) case 1: { -#pragma omp scan exclusive(argc) // expected-error {{the list item must appear in 'reduction' clause with the 'inscan' modifier of the parent directive}} 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 scan exclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) switch (argc) { #pragma omp scan inclusive(argc) // expected-note 2 {{previous 'scan' directive used here}} @@ -153,24 +151,24 @@ int main() { #pragma omp scan inclusive(argc) // expected-error {{exactly one 'scan' directive must appear in the loop body of an enclosing directive}} } break; } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) for (;;) #pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}} for (;;) { -#pragma omp scan inclusive(argc) // expected-error {{the list item must appear in 'reduction' clause with the 'inscan' modifier of the parent directive}} 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 scan inclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) { label: #pragma omp scan inclusive(argc) } -#pragma omp simd reduction(inscan, +: argc) +#pragma omp simd for (int i = 0; i < 10; ++i) { label1 : { #pragma omp scan inclusive(argc) } } - return tmain(); + return tmain(argc); } -- 2.7.4