[cfe-commits] r53659 - /cfe/trunk/lib/Analysis/GRSimpleVals.cpp

Ted Kremenek kremenek at apple.com
Tue Jul 15 17:23:50 PDT 2008


Author: kremenek
Date: Tue Jul 15 19:23:49 2008
New Revision: 53659

URL: http://llvm.org/viewvc/llvm-project?rev=53659&view=rev
Log:
Fix regression introduced by http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080714/006514.html.

The regression was the casts from integers to pointers where not being handled: they would just return UnknownVal.  This would greatly decrease path-sensitivity.


Modified:
    cfe/trunk/lib/Analysis/GRSimpleVals.cpp

Modified: cfe/trunk/lib/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRSimpleVals.cpp?rev=53659&r1=53658&r2=53659&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/lib/Analysis/GRSimpleVals.cpp Tue Jul 15 19:23:49 2008
@@ -377,8 +377,10 @@
   if (!isa<nonlval::ConcreteInt>(X))
     return UnknownVal();
 
+  bool isLValType = LVal::IsLValType(T);
+  
   // Only handle casts from integers to integers.
-  if (!T->isIntegerType())
+  if (!isLValType && !T->isIntegerType())
     return UnknownVal();
   
   BasicValueFactory& BasicVals = Eng.getBasicVals();
@@ -387,7 +389,7 @@
   V.setIsUnsigned(T->isUnsignedIntegerType() || LVal::IsLValType(T));
   V.extOrTrunc(Eng.getContext().getTypeSize(T));
   
-  if (LVal::IsLValType(T))
+  if (isLValType)
     return lval::ConcreteInt(BasicVals.getValue(V));
   else
     return nonlval::ConcreteInt(BasicVals.getValue(V));





More information about the cfe-commits mailing list