aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/Store.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/Store.cpp')
-rw-r--r--lib/Analysis/Store.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp
index e9b8f6a27f..76437d2c86 100644
--- a/lib/Analysis/Store.cpp
+++ b/lib/Analysis/Store.cpp
@@ -68,7 +68,12 @@ StoreManager::CastRegion(const GRState* state, const MemRegion* R,
// FIXME: We should have a standard query function to get the size
// of the array index.
SVal Idx = ValMgr.makeZeroVal(ValMgr.getContext().VoidPtrTy);
- ElementRegion* ER = MRMgr.getElementRegion(Pointee, Idx, TR);
+
+ // If the super region is an element region, strip it away.
+ // FIXME: Is this the right thing to do in all cases?
+ const TypedRegion *Base = isa<ElementRegion>(TR) ?
+ cast<TypedRegion>(TR->getSuperRegion()) : TR;
+ ElementRegion* ER = MRMgr.getElementRegion(Pointee, Idx, Base);
return CastResult(state, ER);
}
}