aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-11 04:04:20 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-11 04:04:20 +0000
commitac6ff48cc3821b0177828392ea83db9bf015f4c1 (patch)
treedf2a74df8138fe92f710da4ba14a2cc5df458136 /lib/Analysis/RegionStore.cpp
parent672e408f14b528fe5e41c5dc99e95e671149a1e9 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r--lib/Analysis/RegionStore.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 2f4d70a577..6253e6182f 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -630,8 +630,12 @@ SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R) {
// 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);