diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-05-04 15:25:46 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-05-04 15:25:46 +0000 |
commit | c2eeb72a7301b0409073311ccbf5da77dccfcc37 (patch) | |
tree | 515b5ce4a22e67c0f13da74e2a1d5bf6d60bd0f6 /lib/Analysis/BasicStore.cpp | |
parent | dcef78d007f802c0e4136fe041b8c1687f219c48 (diff) |
Add array index assertion: BasicStore should not expect any fancy
ElementRegions that have non-zero array indices.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicStore.cpp')
-rw-r--r-- | lib/Analysis/BasicStore.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index 598191f578..95bb6f1a05 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -212,11 +212,14 @@ SVal BasicStoreManager::getLValueElement(const GRState* St, case loc::MemRegionKind: { const MemRegion *R = cast<loc::MemRegionVal>(BaseL).getRegion(); - if (isa<ElementRegion>(R)) { + if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) { // int x; // char* y = (char*) &x; // 'y' => ElementRegion(0, VarRegion('x')) // y[0] = 'a'; + assert(ER->getIndex().isUnknown() || + cast<nonloc::ConcreteInt>(ER->getIndex()).getValue() == 0); + ER = ER; // silence 'unused' warning in release modes. return Base; } |