summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDávid Bolvanský <david.bolvansky@gmail.com>2019-11-09 09:02:40 +0100
committerDávid Bolvanský <david.bolvansky@gmail.com>2019-11-09 09:02:40 +0100
commit312c6f699d4c9c26d16c5eb5848cb9107ae8affe (patch)
treeb8f55be8de186013b0c539cdeae1dcd4fe304887 /clang/lib/Sema/SemaExpr.cpp
parente4da37e8a0a3197baca674d683cb05341c6a4097 (diff)
downloadbcm5719-llvm-312c6f699d4c9c26d16c5eb5848cb9107ae8affe.tar.gz
bcm5719-llvm-312c6f699d4c9c26d16c5eb5848cb9107ae8affe.zip
[Diagnostics] Fixed crash with non pointer type (PR43950)
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 9e917eb7db4..e10331d0741 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -482,7 +482,8 @@ static void CheckForNullPointerDereference(Sema &S, Expr *E) {
// to get a deterministic trap and are surprised by clang's behavior. This
// only handles the pattern "*null", which is a very syntactic check.
const auto *UO = dyn_cast<UnaryOperator>(E->IgnoreParenCasts());
- if (UO && UO->getOpcode() == UO_Deref) {
+ if (UO && UO->getOpcode() == UO_Deref &&
+ UO->getSubExpr()->getType()->isPointerType()) {
const LangAS AS =
UO->getSubExpr()->getType()->getPointeeType().getAddressSpace();
if ((!isTargetAddressSpace(AS) ||
OpenPOWER on IntegriCloud