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

Zhongxing Xu xuzhongxing at gmail.com
Fri Nov 28 00:41:40 PST 2008


Author: zhongxingxu
Date: Fri Nov 28 02:41:39 2008
New Revision: 60207

URL: http://llvm.org/viewvc/llvm-project?rev=60207&view=rev
Log:
Fix a serious bug.

When initialized, the index of the ElementRegion was unsigned. But the index
value of the ArraySubscriptExpr is signed. This inconsistency caused the value
of the array element retrieved to be UnknownVal despite it was initialized to
symbolic.

This is only a hack. Real fix of this problem is required.


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=60207&r1=60206&r2=60207&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Fri Nov 28 02:41:39 2008
@@ -669,8 +669,9 @@
 
     llvm::APInt Size = CAT->getSize();
     llvm::APInt i = llvm::APInt::getNullValue(Size.getBitWidth());
+
     for (; i != Size; ++i) {
-      nonloc::ConcreteInt Idx(getBasicVals().getValue(llvm::APSInt(i)));
+      nonloc::ConcreteInt Idx(getBasicVals().getValue(llvm::APSInt(i, false)));
 
       ElementRegion* ER = MRMgr.getElementRegion(Idx, BaseR);
 
@@ -693,7 +694,7 @@
     llvm::APInt Size = CAT->getSize();
     llvm::APInt i = llvm::APInt::getNullValue(Size.getBitWidth());
     for (; i != Size; ++i) {
-      nonloc::ConcreteInt Idx(getBasicVals().getValue(llvm::APSInt(i)));
+      nonloc::ConcreteInt Idx(getBasicVals().getValue(llvm::APSInt(i, false)));
       
       ElementRegion* ER = MRMgr.getElementRegion(Idx, BaseR);
 





More information about the cfe-commits mailing list