diff options
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/BasicStore.cpp | 9 | ||||
-rw-r--r-- | lib/Analysis/SVals.cpp | 4 | ||||
-rw-r--r-- | lib/Analysis/Store.cpp | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index 969e4c9654..598191f578 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -213,11 +213,10 @@ SVal BasicStoreManager::getLValueElement(const GRState* St, const MemRegion *R = cast<loc::MemRegionVal>(BaseL).getRegion(); if (isa<ElementRegion>(R)) { - // Basic example: - // char buf[100]; - // char *q = &buf[1]; // p points to ElementRegion(buf,Unknown) - // &q[10] - //assert(cast<ElementRegion>(R)->getIndex().isUnknown()); + // int x; + // char* y = (char*) &x; + // 'y' => ElementRegion(0, VarRegion('x')) + // y[0] = 'a'; return Base; } diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp index 71f09d2dfc..43ede0f7cd 100644 --- a/lib/Analysis/SVals.cpp +++ b/lib/Analysis/SVals.cpp @@ -227,6 +227,10 @@ SVal ValueManager::makeZeroVal(QualType T) { return UnknownVal(); } +SVal ValueManager::makeZeroIndex() { + return nonloc::ConcreteInt(BasicVals.getZeroWithPtrWidth(false)); +} + //===----------------------------------------------------------------------===// // Utility methods for constructing Non-Locs. //===----------------------------------------------------------------------===// diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp index 76437d2c86..c9c49c6e9b 100644 --- a/lib/Analysis/Store.cpp +++ b/lib/Analysis/Store.cpp @@ -67,7 +67,7 @@ StoreManager::CastRegion(const GRState* state, const MemRegion* R, // the types aren't the same, so we construct an ElementRegion. // FIXME: We should have a standard query function to get the size // of the array index. - SVal Idx = ValMgr.makeZeroVal(ValMgr.getContext().VoidPtrTy); + SVal Idx = ValMgr.makeZeroIndex(); // If the super region is an element region, strip it away. // FIXME: Is this the right thing to do in all cases? |