Skip to content

Commit 312c6f6

Browse files
[Diagnostics] Fixed crash with non pointer type (PR43950)
1 parent e4da37e commit 312c6f6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ static void CheckForNullPointerDereference(Sema &S, Expr *E) {
482482
// to get a deterministic trap and are surprised by clang's behavior. This
483483
// only handles the pattern "*null", which is a very syntactic check.
484484
const auto *UO = dyn_cast<UnaryOperator>(E->IgnoreParenCasts());
485-
if (UO && UO->getOpcode() == UO_Deref) {
485+
if (UO && UO->getOpcode() == UO_Deref &&
486+
UO->getSubExpr()->getType()->isPointerType()) {
486487
const LangAS AS =
487488
UO->getSubExpr()->getType()->getPointeeType().getAddressSpace();
488489
if ((!isTargetAddressSpace(AS) ||

0 commit comments

Comments
 (0)