diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-05-19 23:37:58 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-05-19 23:37:58 +0000 |
commit | c46d6410947b18ac4c52cff4d0f8021b10a57c1e (patch) | |
tree | 70a34240f49ebc97b172eb837869dfd64a5d16f3 /lib/StaticAnalyzer/Core/RegionStore.cpp | |
parent | 8d3f8979e46f9d0b8735566eabe471db0e1e0e53 (diff) |
Teach RegionStore not to symbolic array values whose indices it cannot reason about.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131702 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/RegionStore.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp index fe17773fc7..d0d8f601f0 100644 --- a/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1063,6 +1063,11 @@ SVal RegionStoreManager::RetrieveElement(Store store, // return *y; // FIXME: This is a hack, and doesn't do anything really intelligent yet. const RegionRawOffset &O = R->getAsArrayOffset(); + + // If we cannot reason about the offset, return an unknown value. + if (!O.getRegion()) + return UnknownVal(); + if (const TypedRegion *baseR = dyn_cast_or_null<TypedRegion>(O.getRegion())) { QualType baseT = baseR->getValueType(); if (baseT->isScalarType()) { |