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)
- : DKind(DKind), CKind(CKind), RefExpr(RefExpr),
+ SourceLocation ImplicitDSALoc, unsigned Modifier)
+ : DKind(DKind), CKind(CKind), Modifier(Modifier), RefExpr(RefExpr),
PrivateCopy(PrivateCopy), ImplicitDSALoc(ImplicitDSALoc) {}
};
using OperatorOffsetTy =
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<const Expr *, 1, bool> RefExpr;
/// List of globals marked as declare target link in this target region
/// (isOpenMPTargetExecutionDirective(Directive) == true).
llvm::SmallVector<DeclRefExpr *, 4> DeclareTargetLinkVarDecls;
+ /// List of decls used in inclusive/exclusive clauses of the scan directive.
+ llvm::DenseSet<CanonicalDeclPtr<Decl>> UsedInScanDirective;
SharingMapTy(OpenMPDirectiveKind DKind, DeclarationNameInfo Name,
Scope *CurScope, SourceLocation Loc)
: Directive(DKind), DirectiveName(Name), CurScope(CurScope),
/// parent directive.
const ValueDecl *getParentLoopControlVariable(unsigned I) const;
+ /// Marks the specified decl \p D as used in scan directive.
+ void markDeclAsUsedInScanDirective(ValueDecl *D) {
+ if (SharingMapTy *Stack = getSecondOnStackOrNull())
+ Stack->UsedInScanDirective.insert(D);
+ }
+
+ /// Checks if the specified declaration was used in the inner scan directive.
+ bool isUsedInScanDirective(ValueDecl *D) const {
+ if (const SharingMapTy *Stack = getTopOfStackOrNull())
+ return Stack->UsedInScanDirective.count(D) > 0;
+ return false;
+ }
+
/// Adds explicit data sharing attribute to the specified declaration.
void addDSA(const ValueDecl *D, const Expr *E, OpenMPClauseKind A,
- DeclRefExpr *PrivateCopy = nullptr);
+ DeclRefExpr *PrivateCopy = nullptr, unsigned Modifier = 0);
/// Adds additional information for the reduction items with the reduction id
/// represented as an operator.
DVar.PrivateCopy = Data.PrivateCopy;
DVar.CKind = Data.Attributes;
DVar.ImplicitDSALoc = Iter->DefaultAttrLoc;
+ DVar.Modifier = Data.Modifier;
return DVar;
}
}
void DSAStackTy::addDSA(const ValueDecl *D, const Expr *E, OpenMPClauseKind A,
- DeclRefExpr *PrivateCopy) {
+ DeclRefExpr *PrivateCopy, unsigned Modifier) {
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;
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;
"set.");
TaskgroupDescriptor = I->TaskgroupReductionRef;
return DSAVarData(OMPD_taskgroup, OMPC_reduction, Data.RefExpr.getPointer(),
- Data.PrivateCopy, I->DefaultAttrLoc);
+ Data.PrivateCopy, I->DefaultAttrLoc, /*Modifier=*/0);
}
return DSAVarData();
}
"set.");
TaskgroupDescriptor = I->TaskgroupReductionRef;
return DSAVarData(OMPD_taskgroup, OMPC_reduction, Data.RefExpr.getPointer(),
- Data.PrivateCopy, I->DefaultAttrLoc);
+ Data.PrivateCopy, I->DefaultAttrLoc, /*Modifier=*/0);
}
return DSAVarData();
}
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<OMPThreadPrivateDeclAttr>()) {
const_iterator EndI = end();
if (FromParent && I != EndI)
++I;
- auto It = I->SharingMap.find(D);
- if (It != I->SharingMap.end()) {
- const DSAInfo &Data = It->getSecond();
- DVar.RefExpr = Data.RefExpr.getPointer();
- DVar.PrivateCopy = Data.PrivateCopy;
- DVar.CKind = Data.Attributes;
- DVar.ImplicitDSALoc = I->DefaultAttrLoc;
- DVar.DKind = I->Directive;
- return DVar;
+ if (I != EndI) {
+ auto It = I->SharingMap.find(D);
+ if (It != I->SharingMap.end()) {
+ const DSAInfo &Data = It->getSecond();
+ DVar.RefExpr = Data.RefExpr.getPointer();
+ DVar.PrivateCopy = Data.PrivateCopy;
+ DVar.CKind = Data.Attributes;
+ DVar.ImplicitDSALoc = I->DefaultAttrLoc;
+ DVar.DKind = I->Directive;
+ DVar.Modifier = Data.Modifier;
+ return DVar;
+ }
}
DVar.CKind = OMPC_shared;
const_iterator EndI = end();
if (FromParent && I != EndI)
++I;
+ if (I == EndI)
+ return DVar;
auto It = I->SharingMap.find(D);
if (It != I->SharingMap.end()) {
const DSAInfo &Data = It->getSecond();
DVar.CKind = Data.Attributes;
DVar.ImplicitDSALoc = I->DefaultAttrLoc;
DVar.DKind = I->Directive;
+ DVar.Modifier = Data.Modifier;
}
return DVar;
DSAStack->setClauseParsingMode(/*K=*/OMPC_unknown);
}
-static void checkAllocateClauses(Sema &S, DSAStackTy *Stack,
- ArrayRef<OMPClause *> Clauses);
static std::pair<ValueDecl *, bool>
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<OMPClause *> 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<OMPReductionClause>(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<OMPReductionClause>(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<OMPClause *> Clauses);
static DeclRefExpr *buildCapture(Sema &S, ValueDecl *D, Expr *CaptureExpr,
bool WithInit);
// Check allocate clauses.
if (!CurContext->isDependentContext())
checkAllocateClauses(*this, DSAStack, D->clauses());
+ checkReductionClauses(*this, DSAStack, D->clauses());
}
DSAStack->pop();
SmallVector<Decl *, 4> ExprCaptures;
/// List of postupdate expressions.
SmallVector<Expr *, 4> ExprPostUpdates;
+ /// Reduction modifier.
+ unsigned RedModifier = 0;
ReductionData() = delete;
/// Reserves required memory for the reduction data.
- ReductionData(unsigned Size) {
+ ReductionData(unsigned Size, unsigned Modifier = 0) : RedModifier(Modifier) {
Vars.reserve(Size);
Privates.reserve(Size);
LHSs.reserve(Size);
}
// All reduction items are still marked as reduction (to do not increase
// code base size).
- Stack->addDSA(D, RefExpr->IgnoreParens(), OMPC_reduction, Ref);
+ Stack->addDSA(D, RefExpr->IgnoreParens(), OMPC_reduction, Ref,
+ RD.RedModifier);
if (CurrDir == OMPD_taskgroup) {
if (DeclareReductionRef.isUsable())
Stack->addTaskgroupReductionData(D, ReductionIdRange,
<< 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());
+ ReductionData RD(VarList.size(), Modifier);
if (actOnOMPReductionKindClause(*this, DSAStack, OMPC_reduction, VarList,
StartLoc, LParenLoc, ColonLoc, EndLoc,
ReductionIdScopeSpec, ReductionId,
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);
}
if (!D)
continue;
+ OpenMPDirectiveKind ParentDirective = DSAStack->getParentDirective();
+ DSAStackTy::DSAVarData DVar;
+ if (ParentDirective != OMPD_unknown)
+ 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 (ParentDirective == OMPD_unknown || DVar.CKind != OMPC_reduction ||
+ DVar.Modifier != OMPC_REDUCTION_inscan) {
+ Diag(ELoc, diag::err_omp_inclusive_exclusive_not_reduction)
+ << RefExpr->getSourceRange();
+ } else {
+ DSAStack->markDeclAsUsedInScanDirective(D);
+ }
Vars.push_back(RefExpr);
}
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ferror-limit 150 %s
-// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ferror-limit 150 %s
template <class T>
-T tmain(T argc) {
+T tmain() {
+ static 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}}
#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
+#pragma omp for simd reduction(inscan, +: argc)
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 simd
+#pragma omp simd reduction(inscan, +: argc)
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 simd
+#pragma omp simd reduction(inscan, +: argc)
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
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i)
do {
#pragma omp scan inclusive(argc)
} while (argc);
-#pragma omp simd
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i)
switch (argc)
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
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 simd
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i)
switch (argc) {
#pragma omp scan exclusive(argc) // expected-note 2 {{previous 'scan' directive used here}}
#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
+#pragma omp simd reduction(inscan, +: argc)
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 simd
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i) {
label:
#pragma omp scan exclusive(argc)
}
-#pragma omp simd
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i) {
label1 : {
#pragma omp scan inclusive(argc)
return T();
}
-int main(int argc, char **argv) {
-#pragma omp simd
+int main() {
+ static int argc;
+#pragma omp simd reduction(inscan, +: argc)
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
+#pragma omp simd reduction(inscan, +: argc)
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
+#pragma omp simd reduction(inscan, +: argc)
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
+#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}}
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
+#pragma omp simd reduction(inscan, +: argc)
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) // 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 simd
+#pragma omp simd reduction(inscan, +: argc)
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) // 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 simd
+#pragma omp simd reduction(inscan, +: argc)
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
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i)
do {
#pragma omp scan exclusive(argc)
} while (argc);
-#pragma omp simd
+#pragma omp simd reduction(inscan, +: argc)
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 {{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}} 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}}
switch (argc)
case 1: {
-#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) // 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 simd
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i)
switch (argc) {
#pragma omp scan inclusive(argc) // expected-note 2 {{previous 'scan' directive used here}}
#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
+#pragma omp simd reduction(inscan, +: argc)
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 {{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) // 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 simd
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i) {
label:
#pragma omp scan inclusive(argc)
}
-#pragma omp simd
+#pragma omp simd reduction(inscan, +: argc)
for (int i = 0; i < 10; ++i) {
label1 : {
#pragma omp scan inclusive(argc)
}
}
- return tmain(argc);
+ return tmain<int>();
}