[cfe-commits] r163068 - /cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp

Jordan Rose jordan_rose at apple.com
Sat Sep 1 10:39:18 PDT 2012


Author: jrose
Date: Sat Sep  1 12:39:17 2012
New Revision: 163068

URL: http://llvm.org/viewvc/llvm-project?rev=163068&view=rev
Log:
[analyzer] Don't attempt to create a floating-point value of "1" for ++/--.

The current logic would actually create a float- or double-sized signed
integer value of 1, which is not at all the same.

No test because the value would be swallowed by an Unknown as soon as it
gets added or subtracted to the original value, but it enables the cleanup
in the next patch.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp?rev=163068&r1=163067&r2=163068&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp Sat Sep  1 12:39:17 2012
@@ -857,8 +857,10 @@
     
     if (U->getType()->isAnyPointerType())
       RHS = svalBuilder.makeArrayIndex(1);
-    else
+    else if (U->getType()->isIntegralOrEnumerationType())
       RHS = svalBuilder.makeIntVal(1, U->getType());
+    else
+      RHS = UnknownVal();
     
     SVal Result = evalBinOp(state, Op, V2, RHS, U->getType());
     





More information about the cfe-commits mailing list