diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-03-11 04:04:20 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-03-11 04:04:20 +0000 |
commit | 90e213f025e32b796db9d526d41caa8c6b84c40c (patch) | |
tree | a4e25712e69935d678b8ef45023a89f3a424d555 | |
parent | 154c96331774d8d7f063b88b2cd73a69ded70800 (diff) | |
download | bcm5719-llvm-90e213f025e32b796db9d526d41caa8c6b84c40c.tar.gz bcm5719-llvm-90e213f025e32b796db9d526d41caa8c6b84c40c.zip |
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.
llvm-svn: 66638
-rw-r--r-- | clang/lib/Analysis/RegionStore.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp index 2f4d70a577a..6253e6182f4 100644 --- a/clang/lib/Analysis/RegionStore.cpp +++ b/clang/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); |