summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BasicStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-25 23:29:04 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-25 23:29:04 +0000
commitc4c48be88e4f296f1dd65e69a0c0f87b3ec4ada6 (patch)
tree7216da27ff5dbe2e2c5348e0d203d5fccd0ea12b /clang/lib/Analysis/BasicStore.cpp
parente5af8cd13bde56cbad543a150e6e197e2edb9281 (diff)
downloadbcm5719-llvm-c4c48be88e4f296f1dd65e69a0c0f87b3ec4ada6.tar.gz
bcm5719-llvm-c4c48be88e4f296f1dd65e69a0c0f87b3ec4ada6.zip
Fix regression in BasicStoreManager caused by implicitly casting loaded values and trying to load/store from arrays. RegionStoreManager already properly handles these cases well; we just need to gracefully not handle this case in BasicStoreManager. This fixes PR 4781.
llvm-svn: 80051
Diffstat (limited to 'clang/lib/Analysis/BasicStore.cpp')
-rw-r--r--clang/lib/Analysis/BasicStore.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Analysis/BasicStore.cpp b/clang/lib/Analysis/BasicStore.cpp
index e2113396581..682feb50d82 100644
--- a/clang/lib/Analysis/BasicStore.cpp
+++ b/clang/lib/Analysis/BasicStore.cpp
@@ -340,6 +340,13 @@ Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {
if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
return store;
+ const TypedRegion *TyR = cast<TypedRegion>(R);
+
+ // Do not bind to arrays. We need to explicitly check for this so that
+ // we do not encounter any weirdness of trying to load/store from arrays.
+ if (TyR->isBoundable() && TyR->getValueType(C)->isArrayType())
+ return store;
+
if (nonloc::LocAsInteger *X = dyn_cast<nonloc::LocAsInteger>(&V)) {
// Only convert 'V' to a location iff the underlying region type
// is a location as well.
@@ -347,11 +354,8 @@ Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {
// a pointer. We may wish to flag a type error here if the types
// are incompatible. This may also cause lots of breakage
// elsewhere. Food for thought.
- if (const TypedRegion *TyR = dyn_cast<TypedRegion>(R)) {
- if (TyR->isBoundable() &&
- Loc::IsLocType(TyR->getValueType(C)))
- V = X->getLoc();
- }
+ if (TyR->isBoundable() && Loc::IsLocType(TyR->getValueType(C)))
+ V = X->getLoc();
}
BindingsTy B = GetBindings(store);
OpenPOWER on IntegriCloud