Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21476,8 +21476,11 @@ ExprResult Sema::CheckPlaceholderExpr(Expr *E) {

// Expressions of unknown type.
case BuiltinType::ArraySection:
Diag(E->getBeginLoc(), diag::err_array_section_use)
<< cast<ArraySectionExpr>(E)->isOMPArraySection();
// If we've already diagnosed something on the array section type, we
// shouldn't need to do any further diagnostic here.
if (!E->containsErrors())
Diag(E->getBeginLoc(), diag::err_array_section_use)
<< cast<ArraySectionExpr>(E)->isOMPArraySection();
return ExprError();

// Expressions of unknown type.
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaOpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,8 @@ ExprResult SemaOpenACC::ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc,
// If any part of the expression is dependent, return a dependent sub-array.
QualType ArrayExprTy = Context.ArraySectionTy;
if (Base->isTypeDependent() ||
(LowerBound && LowerBound->isInstantiationDependent()) ||
(Length && Length->isInstantiationDependent()))
(LowerBound && LowerBound->isTypeDependent()) ||
(Length && Length->isTypeDependent()))
ArrayExprTy = Context.DependentTy;

return new (Context)
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/combined-construct-copy-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel loop copy(ArrayParam[2:5])
for(int i = 0; i < 5; ++i);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel loop copy((float*)ArrayParam[2:5])
for(int i = 0; i < 5; ++i);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/combined-construct-copyin-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel loop copyin(ArrayParam[2:5])
for(int i = 0; i < 5; ++i);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel loop copyin((float*)ArrayParam[2:5])
for(int i = 0; i < 5; ++i);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/combined-construct-copyout-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel loop copyout(ArrayParam[2:5])
for(int i = 0; i < 5; ++i);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel loop copyout((float*)ArrayParam[2:5])
for(int i = 0; i < 5; ++i);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/combined-construct-create-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel loop create(ArrayParam[2:5])
for(int i = 0; i < 5; ++i);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel loop create((float*)ArrayParam[2:5])
for(int i = 0; i < 5; ++i);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel loop firstprivate(ArrayParam[2:5])
for (int i = 5; i < 10; ++i);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc serial loop firstprivate((float*)ArrayParam[2:5])
for (int i = 5; i < 10; ++i);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel loop no_create(ArrayParam[2:5])
for (unsigned i = 0; i < 5; ++i);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel loop no_create((float*)ArrayParam[2:5])
for (unsigned i = 0; i < 5; ++i);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/combined-construct-present-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel loop present(ArrayParam[2:5])
for(unsigned I = 0; I < 5; ++I);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel loop present((float*)ArrayParam[2:5])
for(unsigned I = 0; I < 5; ++I);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/compute-construct-copy-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel copy(ArrayParam[2:5])
while(1);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel copy((float*)ArrayParam[2:5])
while(1);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/compute-construct-copyin-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel copyin(ArrayParam[2:5])
while(1);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel copyin((float*)ArrayParam[2:5])
while(1);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/compute-construct-copyout-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel copyout(ArrayParam[2:5])
while(1);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel copyout((float*)ArrayParam[2:5])
while(1);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/compute-construct-create-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel create(ArrayParam[2:5])
while(1);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel create((float*)ArrayParam[2:5])
while(1);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel firstprivate(ArrayParam[2:5])
while(1);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel firstprivate((float*)ArrayParam[2:5])
while(1);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel no_create(ArrayParam[2:5])
while(1);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel no_create((float*)ArrayParam[2:5])
while(1);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
3 changes: 1 addition & 2 deletions clang/test/SemaOpenACC/compute-construct-present-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void uses(int IntParam, char *PointerParam, float ArrayParam[5], Complete Compos
#pragma acc parallel present(ArrayParam[2:5])
while(1);

// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
#pragma acc parallel present((float*)ArrayParam[2:5])
while(1);
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
Expand Down
14 changes: 14 additions & 0 deletions clang/test/SemaOpenACC/compute-construct-private-clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,17 @@ void Inst() {
TemplUses(i, Arr, C); // #TEMPL_USES_INST
NTTP<5, NTTP_REFed>(); // #NTTP_INST
}

template<typename T>
void ThisCrashed(unsigned A, unsigned B) {
T ***ThreePtr;
// expected-error@+1 2{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}}
#pragma acc parallel private(ThreePtr[A:B][B][B])
;
}

void inst_crash() {
// expected-note@+1{{in instantiation}}
ThisCrashed<int>(1, 2);
}