aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2008-11-28 08:41:39 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2008-11-28 08:41:39 +0000
commit96cb9fb62008276266257ae7b53fa4b64224290d (patch)
tree55a29783b1c2078c95b589bca73335b6707da09b /lib/Analysis/RegionStore.cpp
parentd5b499d43c3526fae7f9ebb6e2d50e79d3496ced (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60207 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r--lib/Analysis/RegionStore.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 157248f21b..981d69c822 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -669,8 +669,9 @@ Store RegionStoreManager::BindArrayToVal(Store store, const TypedRegion* BaseR,
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 @@ Store RegionStoreManager::BindArrayToSymVal(Store store,
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);