[cfe-commits] r66638 - /cfe/trunk/lib/Analysis/RegionStore.cpp

Ted Kremenek kremenek at apple.com
Tue Mar 10 21:04:20 PDT 2009


Author: kremenek
Date: Tue Mar 10 23:04:20 2009
New Revision: 66638

URL: http://llvm.org/viewvc/llvm-project?rev=66638&view=rev
Log:
RegionStore::getLValueElement: Handle the case where the signedness of the
offset may be different that the base. Ultimately we need a better solution for
these issues, but this point-by-point fixes are gradually outlining the scope of
the problem.

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

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

==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Tue Mar 10 23:04:20 2009
@@ -630,8 +630,12 @@
 
   // Only support concrete integer indexes for now.
   if (Base && Offset) {
-    SVal NewIdx = Base->EvalBinOp(getBasicVals(), Op, *Offset);
-
+    // For now, convert the signedness of offset in case it doesn't match.
+    const llvm::APSInt &I =
+      getBasicVals().ConvertSignedness(Base->getValue(), Offset->getValue());    
+    nonloc::ConcreteInt OffsetConverted(I);
+    
+    SVal NewIdx = Base->EvalBinOp(getBasicVals(), Op, OffsetConverted);
     const MemRegion* NewER = MRMgr.getElementRegion(NewIdx, 
                                                     ER->getArrayRegion());
     return Loc::MakeVal(NewER);





More information about the cfe-commits mailing list