Skip to content

Commit 2715f36

Browse files
committed
Fix crash on relational comparison with null.
1 parent 9a9e326 commit 2715f36

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14631,9 +14631,10 @@ EvaluateComparisonBinaryOperator(EvalInfo &Info, const BinaryOperator *E,
1463114631
// - Otherwise pointer comparisons are unspecified.
1463214632
if (!LHSDesignator.Invalid && !RHSDesignator.Invalid && IsRelational) {
1463314633
bool WasArrayIndex;
14634-
unsigned Mismatch =
14635-
FindDesignatorMismatch(getType(LHSValue.Base).getNonReferenceType(),
14636-
LHSDesignator, RHSDesignator, WasArrayIndex);
14634+
unsigned Mismatch = FindDesignatorMismatch(
14635+
LHSValue.Base.isNull() ? QualType()
14636+
: getType(LHSValue.Base).getNonReferenceType(),
14637+
LHSDesignator, RHSDesignator, WasArrayIndex);
1463714638
// At the point where the designators diverge, the comparison has a
1463814639
// specified value if:
1463914640
// - we are comparing array indices

0 commit comments

Comments
 (0)