]> granicus.if.org Git - clang/commitdiff
[analyzer] Don't attempt to create a floating-point value of "1" for ++/--.
authorJordan Rose <jordan_rose@apple.com>
Sat, 1 Sep 2012 17:39:17 +0000 (17:39 +0000)
committerJordan Rose <jordan_rose@apple.com>
Sat, 1 Sep 2012 17:39:17 +0000 (17:39 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163068 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/ExprEngineC.cpp

index 8881f26366b62c66367dc3fea5278d1652d9d9aa..3bf16fa0da6e95df693d9ad1207f4bf8cf7f6914 100644 (file)
@@ -857,8 +857,10 @@ void ExprEngine::VisitIncrementDecrementOperator(const UnaryOperator* U,
     
     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());