diff options
| author | Ted Kremenek <kremenek@apple.com> | 2010-09-01 23:27:26 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2010-09-01 23:27:26 +0000 |
| commit | 0e12f9cc7bef10704a981e08cd9e29792115ba4e (patch) | |
| tree | 913d39f87bdd761938cc20544c215528ba4d0acd /clang/lib/Checker/RegionStore.cpp | |
| parent | 1b87c9a646526641da7f084b5e8d796800a59f9f (diff) | |
| download | bcm5719-llvm-0e12f9cc7bef10704a981e08cd9e29792115ba4e.tar.gz bcm5719-llvm-0e12f9cc7bef10704a981e08cd9e29792115ba4e.zip | |
Partial fix for PR 8015 (fix is actually by Jordy Rose, and I added a test case for follow-on work). This patch adds a bandaid for RegionStore's limited reasoning about symbolic array values.
llvm-svn: 112766
Diffstat (limited to 'clang/lib/Checker/RegionStore.cpp')
| -rw-r--r-- | clang/lib/Checker/RegionStore.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Checker/RegionStore.cpp b/clang/lib/Checker/RegionStore.cpp index 19945a7b3c8..a2019d7a3c2 100644 --- a/clang/lib/Checker/RegionStore.cpp +++ b/clang/lib/Checker/RegionStore.cpp @@ -1193,13 +1193,18 @@ SVal RegionStoreManager::RetrieveFieldOrElementCommon(Store store, } if (R->hasStackNonParametersStorage()) { - if (isa<ElementRegion>(R)) { + if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) { // Currently we don't reason specially about Clang-style vectors. Check // if superR is a vector and if so return Unknown. if (const TypedRegion *typedSuperR = dyn_cast<TypedRegion>(superR)) { if (typedSuperR->getValueType()->isVectorType()) return UnknownVal(); } + + // FIXME: We also need to take ElementRegions with symbolic indexes into + // account. + if (!ER->getIndex().isConstant()) + return UnknownVal(); } return UndefinedVal(); |

