aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp5
-rw-r--r--test/Analysis/casts.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp b/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
index 92a8eb1a7a..5568f1ca55 100644
--- a/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
+++ b/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
@@ -137,6 +137,11 @@ SimpleConstraintManager::assumeAuxForSymbol(ProgramStateRef State,
SymbolRef Sym, bool Assumption) {
BasicValueFactory &BVF = getBasicVals();
QualType T = Sym->getType(BVF.getContext());
+
+ // None of the constraint solvers currently support non-integer types.
+ if (!T->isIntegerType())
+ return State;
+
const llvm::APSInt &zero = BVF.getValue(0, T);
if (Assumption)
return assumeSymNE(State, Sym, zero, zero);
diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c
index 8b88a2db43..f862ddf573 100644
--- a/test/Analysis/casts.c
+++ b/test/Analysis/casts.c
@@ -65,3 +65,11 @@ void pr6013_6035_test(void *p) {
foo = ((long)(p));
(void) foo;
}
+
+// PR12511 and radar://11215362 - Test that we support SymCastExpr, which represents symbolic int to float cast.
+char ttt(int intSeconds) {
+ double seconds = intSeconds;
+ if (seconds)
+ return 0;
+ return 0;
+}