Expression rearrangement in SValBuilder (see rL329780) crashes with an assert if the type of the integer is different from the type of the symbol. This fix adds a check that prevents rearrangement in such cases.
Differential Revision: https://reviews.llvm.org/D45557
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330064
91177308-0d34-0410-b5e6-
96231b3b80d8
// Initialize SingleTy later with a symbol's type.
} else if (BinaryOperator::isAdditiveOp(Op)) {
SingleTy = ResultTy;
+ if (LSym->getType() != SingleTy)
+ return None;
// Substracting unsigned integers is a nightmare.
if (!SingleTy->isSignedIntegerOrEnumerationType())
return None;
clang_analyzer_eval(n - 126 == m + 3); // expected-warning{{UNKNOWN}}
}
}
+
+int mixed_integer_types(int x, int y) {
+ short a = x - 1U;
+ return a - y;
+}