[cfe-commits] r172274 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExprEngineC.cpp test/Analysis/misc-ps.c
Ted Kremenek
kremenek at apple.com
Fri Jan 11 15:36:25 PST 2013
Author: kremenek
Date: Fri Jan 11 17:36:25 2013
New Revision: 172274
URL: http://llvm.org/viewvc/llvm-project?rev=172274&view=rev
Log:
Refine analyzer's handling of unary '!' and floating types to not assert.
Fixes PR 14634 and <rdar://problem/12903080>.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
cfe/trunk/test/Analysis/misc-ps.c
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp?rev=172274&r1=172273&r2=172274&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp Fri Jan 11 17:36:25 2013
@@ -809,7 +809,10 @@
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());
Modified: cfe/trunk/test/Analysis/misc-ps.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.c?rev=172274&r1=172273&r2=172274&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.c (original)
+++ cfe/trunk/test/Analysis/misc-ps.c Fri Jan 11 17:36:25 2013
@@ -157,3 +157,9 @@
*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;
+}
+
More information about the cfe-commits
mailing list