diff options
-rw-r--r-- | lib/StaticAnalyzer/Core/ExprEngineC.cpp | 5 | ||||
-rw-r--r-- | test/Analysis/misc-ps.c | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/lib/StaticAnalyzer/Core/ExprEngineC.cpp index 1253f8888c..f1ef0f6601 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -809,7 +809,10 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U, Result = evalBinOp(state, BO_EQ, cast<Loc>(V), X, U->getType()); } - else { + else if (Ex->getType()->isFloatingType()) { + // FIXME: handle floating point types. + Result = UnknownVal(); + } else { nonloc::ConcreteInt X(getBasicVals().getValue(0, Ex->getType())); Result = evalBinOp(state, BO_EQ, cast<NonLoc>(V), X, U->getType()); diff --git a/test/Analysis/misc-ps.c b/test/Analysis/misc-ps.c index ef65e0d731..5369ab1061 100644 --- a/test/Analysis/misc-ps.c +++ b/test/Analysis/misc-ps.c @@ -157,3 +157,9 @@ void PR14635(int *p) { *p = a || b; // expected-warning {{Assigned value is garbage or undefined}} } +// Test handling floating point values with unary '!'. +int PR14634(int x) { + double y = (double)x; + return !y; +} + |