summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-13 15:35:24 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-13 15:35:24 +0000
commitec94f08dcea55cc18e2c7d9692b555c7286b13c6 (patch)
tree6b61c5826a36fac5a51488f44cbc027d0fd5ede0 /clang/lib/Analysis/RegionStore.cpp
parent201217324a1c00db2586aff267c39959a1e78e33 (diff)
downloadbcm5719-llvm-ec94f08dcea55cc18e2c7d9692b555c7286b13c6.tar.gz
bcm5719-llvm-ec94f08dcea55cc18e2c7d9692b555c7286b13c6.zip
Fix failure reported by Sebastian of test/Analysis/ptr-arith.c when the target
is 64-bit. I used his suggestion of doing a direct bitwidth/signedness conversion of the 'offset' instead of just changing the sign. For more information, see: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2009-March/004587.html llvm-svn: 66892
Diffstat (limited to 'clang/lib/Analysis/RegionStore.cpp')
-rw-r--r--clang/lib/Analysis/RegionStore.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index fbaa302d31f..5f1c39c2b69 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/lib/Analysis/RegionStore.cpp
@@ -642,12 +642,13 @@ SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R) {
// Only support concrete integer indexes for now.
if (Base && 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);
+ // FIXME: For now, convert the signedness and bitwidth of offset in case
+ // they don't match. This can result from pointer arithmetic. In reality,
+ // we should figure out what are the proper semantics and implement them.
+ //
+ nonloc::ConcreteInt OffConverted(getBasicVals().Convert(Base->getValue(),
+ Offset->getValue()));
+ SVal NewIdx = Base->EvalBinOp(getBasicVals(), Op, OffConverted);
const MemRegion* NewER = MRMgr.getElementRegion(NewIdx,
ER->getArrayRegion());
return Loc::MakeVal(NewER);
OpenPOWER on IntegriCloud