summaryrefslogtreecommitdiffstats
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
commite31a8ebfdcb101be5a48590cda63312d77b5fc45 (patch)
tree024dbd61038b33fdc13357e6fafb225f6054f4ce
parent33178a0993bb6ee368e5d83870718144da536622 (diff)
downloadbcm5719-llvm-e31a8ebfdcb101be5a48590cda63312d77b5fc45.tar.gz
bcm5719-llvm-e31a8ebfdcb101be5a48590cda63312d77b5fc45.zip
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. llvm-svn: 60207
-rw-r--r--clang/lib/Analysis/RegionStore.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index 157248f21bd..981d69c8223 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud