mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
Fix possible crash on null base or type for array elements.
llvm-svn: 245939
This commit is contained in:
@@ -3932,7 +3932,8 @@ static bool checkArithmeticOnObjCPointer(Sema &S,
|
||||
ExprResult
|
||||
Sema::ActOnArraySubscriptExpr(Scope *S, Expr *base, SourceLocation lbLoc,
|
||||
Expr *idx, SourceLocation rbLoc) {
|
||||
if (base->getType()->isSpecificPlaceholderType(BuiltinType::OMPArraySection))
|
||||
if (base && !base->getType().isNull() &&
|
||||
base->getType()->isSpecificPlaceholderType(BuiltinType::OMPArraySection))
|
||||
return ActOnOMPArraySectionExpr(base, lbLoc, idx, SourceLocation(),
|
||||
/*Length=*/nullptr, rbLoc);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
|
||||
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
@@ -18,6 +18,7 @@ int main(int argc, char **argv, char *env[]) {
|
||||
vector vec;
|
||||
typedef float V __attribute__((vector_size(16)));
|
||||
V a;
|
||||
auto arr = x; // expected-error {{use of undeclared identifier 'x'}}
|
||||
|
||||
#pragma omp task depend // expected-error {{expected '(' after 'depend'}}
|
||||
#pragma omp task depend ( // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}}
|
||||
@@ -48,6 +49,7 @@ int main(int argc, char **argv, char *env[]) {
|
||||
#pragma omp task depend(in:argv[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
|
||||
#pragma omp task depend(in:env[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}}
|
||||
#pragma omp task depend(in : argv[ : argc][1 : argc - 1])
|
||||
#pragma omp task depend(in : arr[0])
|
||||
foo();
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user