summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-02-19 08:37:16 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-02-19 08:37:16 +0000
commitf74ab25e222edeb15de97b42d6c596f6d5dd8ad7 (patch)
tree6c2a567762e62b062dbd8cb0b669392e26e797f4 /clang/lib/Analysis/RegionStore.cpp
parent13aada6fc41f388d63b9e6d613d89a8fb5dab924 (diff)
downloadbcm5719-llvm-f74ab25e222edeb15de97b42d6c596f6d5dd8ad7.tar.gz
bcm5719-llvm-f74ab25e222edeb15de97b42d6c596f6d5dd8ad7.zip
Convert the offset to signed before making an ElementRegion with it. It seems
that this problem arises from time to time. We should find a fundamental solution for it. llvm-svn: 65035
Diffstat (limited to 'clang/lib/Analysis/RegionStore.cpp')
-rw-r--r--clang/lib/Analysis/RegionStore.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index 66aabcb49ed..58d8670d30a 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/lib/Analysis/RegionStore.cpp
@@ -367,6 +367,16 @@ SVal RegionStoreManager::getLValueElement(const GRState* St,
//
// Observe that 'p' binds to an AnonTypedRegion<AllocaRegion>.
//
+
+ // Offset might be unsigned. We have to convert it to signed ConcreteInt.
+ if (nonloc::ConcreteInt* CI = dyn_cast<nonloc::ConcreteInt>(&Offset)) {
+ const llvm::APSInt& OffI = CI->getValue();
+ if (OffI.isUnsigned()) {
+ llvm::APSInt Tmp = OffI;
+ Tmp.setIsSigned(true);
+ Offset = NonLoc::MakeVal(getBasicVals(), Tmp);
+ }
+ }
return loc::MemRegionVal(MRMgr.getElementRegion(Offset, BaseRegion));
}
@@ -397,7 +407,7 @@ SVal RegionStoreManager::getLValueElement(const GRState* St,
Tmp.setIsSigned(true);
Tmp += BaseIdxI; // Compute the new offset.
- NewIdx = nonloc::ConcreteInt(getBasicVals().getValue(Tmp));
+ NewIdx = NonLoc::MakeVal(getBasicVals(), Tmp);
}
else
NewIdx = nonloc::ConcreteInt(getBasicVals().getValue(BaseIdxI + OffI));
OpenPOWER on IntegriCloud