mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 14:26:07 +00:00
[OPENMP]Fix PR41768: check DSA for globals with default(none) clauses.
If the default(none) was specified for the construct, we might miss diagnostic for the globals without explicitly specified data-sharing attributes. Patch fixes this problem. llvm-svn: 360362
This commit is contained in:
parent
e406f0eec6
commit
41ebe0ce64
@ -8821,6 +8821,8 @@ def err_omp_threadprivate_incomplete_type : Error<
|
||||
"threadprivate variable with incomplete type %0">;
|
||||
def err_omp_no_dsa_for_variable : Error<
|
||||
"variable %0 must have explicitly specified data sharing attributes">;
|
||||
def note_omp_default_dsa_none : Note<
|
||||
"explicit data sharing attribute requested here">;
|
||||
def err_omp_wrong_dsa : Error<
|
||||
"%0 variable cannot be %1">;
|
||||
def err_omp_variably_modified_type_not_supported : Error<
|
||||
|
@ -8890,7 +8890,8 @@ public:
|
||||
/// Check if the specified variable is used in one of the private
|
||||
/// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
|
||||
/// constructs.
|
||||
VarDecl *isOpenMPCapturedDecl(ValueDecl *D);
|
||||
VarDecl *isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo = false,
|
||||
unsigned StopAt = 0);
|
||||
ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK,
|
||||
ExprObjectKind OK, SourceLocation Loc);
|
||||
|
||||
|
@ -15474,7 +15474,9 @@ bool Sema::tryCaptureVariable(
|
||||
// Capture global variables if it is required to use private copy of this
|
||||
// variable.
|
||||
bool IsGlobal = !Var->hasLocalStorage();
|
||||
if (IsGlobal && !(LangOpts.OpenMP && isOpenMPCapturedDecl(Var)))
|
||||
if (IsGlobal &&
|
||||
!(LangOpts.OpenMP && isOpenMPCapturedDecl(Var, /*CheckScopeInfo=*/true,
|
||||
MaxFunctionScopesIndex)))
|
||||
return true;
|
||||
Var = Var->getCanonicalDecl();
|
||||
|
||||
|
@ -1695,7 +1695,8 @@ bool Sema::isInOpenMPTargetExecutionDirective() const {
|
||||
false);
|
||||
}
|
||||
|
||||
VarDecl *Sema::isOpenMPCapturedDecl(ValueDecl *D) {
|
||||
VarDecl *Sema::isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo,
|
||||
unsigned StopAt) {
|
||||
assert(LangOpts.OpenMP && "OpenMP is not allowed");
|
||||
D = getCanonicalDecl(D);
|
||||
|
||||
@ -1764,6 +1765,22 @@ VarDecl *Sema::isOpenMPCapturedDecl(ValueDecl *D) {
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckScopeInfo) {
|
||||
bool OpenMPFound = false;
|
||||
for (unsigned I = StopAt + 1; I > 0; --I) {
|
||||
FunctionScopeInfo *FSI = FunctionScopes[I - 1];
|
||||
if(!isa<CapturingScopeInfo>(FSI))
|
||||
return nullptr;
|
||||
if (auto *RSI = dyn_cast<CapturedRegionScopeInfo>(FSI))
|
||||
if (RSI->CapRegionKind == CR_OpenMP) {
|
||||
OpenMPFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!OpenMPFound)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (DSAStack->getCurrentDirective() != OMPD_unknown &&
|
||||
(!DSAStack->isClauseParsingMode() ||
|
||||
DSAStack->getParentDirective() != OMPD_unknown)) {
|
||||
@ -1780,7 +1797,10 @@ VarDecl *Sema::isOpenMPCapturedDecl(ValueDecl *D) {
|
||||
DVarPrivate = DSAStack->hasDSA(D, isOpenMPPrivate,
|
||||
[](OpenMPDirectiveKind) { return true; },
|
||||
DSAStack->isClauseParsingMode());
|
||||
if (DVarPrivate.CKind != OMPC_unknown)
|
||||
// The variable is not private or it is the variable in the directive with
|
||||
// default(none) clause and not used in any clause.
|
||||
if (DVarPrivate.CKind != OMPC_unknown ||
|
||||
(VD && DSAStack->getDefaultDSA() == DSA_none))
|
||||
return VD ? VD : cast<VarDecl>(DVarPrivate.PrivateCopy->getDecl());
|
||||
}
|
||||
return nullptr;
|
||||
@ -4184,6 +4204,7 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
|
||||
for (const auto &P : VarsWithInheritedDSA) {
|
||||
Diag(P.second->getExprLoc(), diag::err_omp_no_dsa_for_variable)
|
||||
<< P.first << P.second->getSourceRange();
|
||||
Diag(DSAStack->getDefaultDSALocation(), diag::note_omp_default_dsa_none);
|
||||
}
|
||||
ErrorFound = !VarsWithInheritedDSA.empty() || ErrorFound;
|
||||
|
||||
|
@ -24,7 +24,7 @@ T tmain(T argc) {
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp target
|
||||
@ -39,7 +39,7 @@ T tmain(T argc) {
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default(none)
|
||||
#pragma omp distribute parallel for default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
@ -72,7 +72,7 @@ int main(int argc, char **argv) {
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp target
|
||||
@ -87,7 +87,7 @@ int main(int argc, char **argv) {
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default(none)
|
||||
#pragma omp distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
|
@ -81,7 +81,7 @@ L1:
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for default(none)
|
||||
#pragma omp distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -24,7 +24,7 @@ T tmain(T argc) {
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp target
|
||||
@ -39,7 +39,7 @@ T tmain(T argc) {
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default(none)
|
||||
#pragma omp distribute parallel for simd default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
@ -72,7 +72,7 @@ int main(int argc, char **argv) {
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp target
|
||||
@ -87,7 +87,7 @@ int main(int argc, char **argv) {
|
||||
foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd default(none)
|
||||
#pragma omp distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
|
@ -18,14 +18,14 @@ int main(int argc, char **argv) {
|
||||
#pragma omp parallel default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(none) // ge40-note {{explicit data sharing attribute requested here}}
|
||||
(void)c; // ge40-error {{variable 'c' must have explicitly specified data sharing attributes}}
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ int main(int argc, char **argv) {
|
||||
#pragma omp parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'default' clause}}
|
||||
@ -25,11 +25,11 @@ int main(int argc, char **argv) {
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
#pragma omp parallel for default(none)
|
||||
#pragma omp parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel for default(shared)
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
@ -58,7 +58,7 @@ L1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for default(none)
|
||||
#pragma omp parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -15,7 +15,7 @@ int main(int argc, char **argv) {
|
||||
#pragma omp parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'default' clause}}
|
||||
@ -25,11 +25,11 @@ int main(int argc, char **argv) {
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
#pragma omp parallel for simd default(none)
|
||||
#pragma omp parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel for simd default(shared)
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error {{variable 'i' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
@ -58,7 +58,7 @@ L1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd default(none)
|
||||
#pragma omp parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -7,6 +7,7 @@ void foo() {
|
||||
|
||||
#pragma omp parallel // expected-error {{unexpected OpenMP directive '#pragma omp parallel'}}
|
||||
|
||||
int a;
|
||||
struct S;
|
||||
S& bar();
|
||||
int main(int argc, char **argv) {
|
||||
@ -54,8 +55,11 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel default(none)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
++a; // expected-error {{variable 'a' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
|
||||
goto L2; // expected-error {{use of undeclared label 'L2'}}
|
||||
#pragma omp parallel
|
||||
@ -73,3 +77,25 @@ int main(int argc, char **argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct a {
|
||||
static constexpr int b = 0;
|
||||
};
|
||||
template <bool> struct c;
|
||||
template <typename d, typename e> bool operator<(d, e);
|
||||
struct f {
|
||||
int cbegin;
|
||||
};
|
||||
class g {
|
||||
f blocks;
|
||||
void j();
|
||||
};
|
||||
template <typename> struct is_error_code_enum : a {};
|
||||
struct h {
|
||||
template <typename i, typename = c<is_error_code_enum<i>::b>> h(i);
|
||||
};
|
||||
h operator<(h, h);
|
||||
void g::j() {
|
||||
#pragma omp parallel for default(none)
|
||||
for (auto a = blocks.cbegin; a < blocks; ++a) // expected-error {{invalid operands to binary expression ('f' and 'int')}}
|
||||
;
|
||||
}
|
||||
|
@ -25,12 +25,12 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel sections default(none)
|
||||
#pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
|
||||
#pragma omp parallel sections default(none)
|
||||
#pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
#pragma omp parallel sections default(shared)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel sections default(none)
|
||||
#pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ void foo(int x, int n) {
|
||||
for (int iter = 0; iter < x; iter++) {
|
||||
#pragma omp target teams distribute parallel for map( \
|
||||
from \
|
||||
: vec [0:n]) default(none)
|
||||
: vec [0:n]) default(none) // expected-note 4 {{explicit data sharing attribute requested here}}
|
||||
// expected-error@+1 {{variable 'n' must have explicitly specified data sharing attributes}}
|
||||
for (int ii = 0; ii < n; ii++) {
|
||||
// expected-error@+3 {{variable 'iter' must have explicitly specified data sharing attributes}}
|
||||
|
@ -18,14 +18,14 @@ int main(int argc, char **argv) {
|
||||
#pragma omp target parallel default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp target parallel default(none)
|
||||
#pragma omp target parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp target parallel default(none)
|
||||
foo();
|
||||
#pragma omp target parallel default(shared)
|
||||
++argc;
|
||||
#pragma omp target parallel default(none)
|
||||
#pragma omp target parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
return 0;
|
||||
|
@ -15,7 +15,7 @@ int main(int argc, char **argv) {
|
||||
#pragma omp target parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp target parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp target parallel for' cannot contain more than one 'default' clause}}
|
||||
@ -25,7 +25,7 @@ int main(int argc, char **argv) {
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
#pragma omp target parallel for default(none)
|
||||
#pragma omp target parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
|
@ -61,7 +61,7 @@ L1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp target parallel for default(none)
|
||||
#pragma omp target parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -15,7 +15,7 @@ int main(int argc, char **argv) {
|
||||
#pragma omp target parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp target parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
#pragma omp target parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp target parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp target parallel for simd' cannot contain more than one 'default' clause}}
|
||||
@ -25,7 +25,7 @@ int main(int argc, char **argv) {
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
#pragma omp target parallel for simd default(none)
|
||||
#pragma omp target parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
|
@ -61,7 +61,7 @@ L1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp target parallel for simd default(none)
|
||||
#pragma omp target parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -18,10 +18,10 @@ int main(int argc, char **argv) {
|
||||
#pragma omp target teams default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp target teams default(none)
|
||||
#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp target teams default(none)
|
||||
#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
return 0;
|
||||
|
@ -18,7 +18,7 @@ int main(int argc, char **argv) {
|
||||
#pragma omp target teams distribute default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute default(none)
|
||||
#pragma omp target teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
return 0;
|
||||
|
@ -61,7 +61,7 @@ L1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp target teams distribute default(none)
|
||||
#pragma omp target teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -18,7 +18,7 @@ int main(int argc, char **argv) {
|
||||
#pragma omp target teams distribute parallel for default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute parallel for default(none)
|
||||
#pragma omp target teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
return 0;
|
||||
|
@ -61,7 +61,7 @@ L1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp target teams distribute parallel for default(none)
|
||||
#pragma omp target teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -23,7 +23,7 @@ int main(int argc, char **argv) {
|
||||
#pragma omp target teams distribute parallel for simd default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target teams distribute parallel for simd default(none)
|
||||
#pragma omp target teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
return 0;
|
||||
|
@ -62,7 +62,7 @@ L1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp target teams distribute parallel for simd default(none)
|
||||
#pragma omp target teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -47,14 +47,14 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp target teams default(none)
|
||||
#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp target teams default(none)
|
||||
#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel num_threads(argc) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
;
|
||||
|
||||
#pragma omp target teams default(none)
|
||||
#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
{
|
||||
#pragma omp parallel num_threads(argc) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
;
|
||||
|
@ -13,10 +13,10 @@ int main(int argc, char **argv) {
|
||||
#pragma omp task default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
foo();
|
||||
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
return 0;
|
||||
|
@ -23,7 +23,7 @@ template <typename T>
|
||||
struct S {
|
||||
T b;
|
||||
S(T a, T c) {
|
||||
#pragma omp task default(none) firstprivate(a, b)
|
||||
#pragma omp task default(none) firstprivate(a, b) // expected-note {{explicit data sharing attribute requested here}}
|
||||
a = b = c; // expected-error {{variable 'c' must have explicitly specified data sharing attributes}}
|
||||
}
|
||||
};
|
||||
|
@ -38,10 +38,10 @@ int foo() {
|
||||
#pragma omp task
|
||||
// expected-note@+1 2 {{predetermined as a firstprivate in a task construct here}}
|
||||
++s1;
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task default(shared)
|
||||
++a; // expected-error 2 {{variable 'a' must have explicitly specified data sharing attributes}}
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note 2 {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task
|
||||
// expected-error@+1 {{calling a private constructor of class 'S'}}
|
||||
++a; // expected-error 2 {{variable 'a' must have explicitly specified data sharing attributes}}
|
||||
@ -167,7 +167,7 @@ L1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
goto L2; // expected-error {{use of undeclared label 'L2'}}
|
||||
@ -184,10 +184,10 @@ L2:
|
||||
for (int n = 0; n < 100; ++n) {
|
||||
}
|
||||
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task default(shared)
|
||||
++a; // expected-error {{variable 'a' must have explicitly specified data sharing attributes}}
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task
|
||||
++a; // expected-error {{variable 'a' must have explicitly specified data sharing attributes}}
|
||||
#pragma omp task default(shared)
|
||||
@ -201,10 +201,10 @@ L2:
|
||||
#pragma omp task
|
||||
#pragma omp parallel shared(a, b)
|
||||
++a, ++b;
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task default(shared)
|
||||
++sa; // expected-error {{variable 'sa' must have explicitly specified data sharing attributes}}
|
||||
#pragma omp task default(none)
|
||||
#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp task
|
||||
// expected-error@+1 {{calling a private constructor of class 'S'}}
|
||||
++sa; // expected-error {{variable 'sa' must have explicitly specified data sharing attributes}}
|
||||
|
@ -25,11 +25,11 @@ int main(int argc, char **argv) {
|
||||
foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams default(none)
|
||||
#pragma omp teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams default(none)
|
||||
#pragma omp teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
#pragma omp parallel default(shared)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
return 0;
|
||||
|
@ -25,7 +25,7 @@ int main(int argc, char **argv) {
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute default(none)
|
||||
#pragma omp teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
return 0;
|
||||
|
@ -25,7 +25,7 @@ int main(int argc, char **argv) {
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default(none)
|
||||
#pragma omp teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
return 0;
|
||||
|
@ -76,7 +76,7 @@ L1:
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for default(none)
|
||||
#pragma omp teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -25,7 +25,7 @@ int main(int argc, char **argv) {
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd default(none)
|
||||
#pragma omp teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
return 0;
|
||||
|
@ -76,7 +76,7 @@ L1:
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd default(none)
|
||||
#pragma omp teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -25,7 +25,7 @@ int main(int argc, char **argv) {
|
||||
for (int i=0; i<200; i++) foo();
|
||||
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default(none)
|
||||
#pragma omp teams distribute simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
return 0;
|
||||
|
@ -76,7 +76,7 @@ L1:
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd default(none)
|
||||
#pragma omp teams distribute simd default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
|
@ -63,7 +63,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams default(none)
|
||||
#pragma omp teams default(none) // expected-note {{explicit data sharing attribute requested here}}
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
goto L2; // expected-error {{use of undeclared label 'L2'}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user