diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-02-06 04:04:46 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-02-06 04:04:46 +0000 |
commit | 81861abe9cd1669ca46e13866f77f7ece8c4c85f (patch) | |
tree | 591ac2a3e1463c2fa1e5f80a17c7c337399a11bc | |
parent | 4dc1566a80648a74a19409c425809fa6a1683bef (diff) |
Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are implicitly initialized to NULL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95479 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Checker/RegionStore.cpp | 4 | ||||
-rw-r--r-- | test/Analysis/misc-ps.m | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp index 2e212db3e6..36022d5737 100644 --- a/lib/Checker/RegionStore.cpp +++ b/lib/Checker/RegionStore.cpp @@ -1407,7 +1407,9 @@ SVal RegionStoreManager::RetrieveVar(Store store, const VarRegion *R) { if (T->isIntegerType()) return ValMgr.makeIntVal(0, T); - + if (T->isPointerType()) + return ValMgr.makeNull(); + return UnknownVal(); } diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index c1b3d9788b..20eed9cb3d 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -908,3 +908,10 @@ void rdar7582031_test_static_init_zero() { int *p = 0; *p = 0xDEADBEEF; } +void rdar7582031_test_static_init_zero_b() { + static void* x; + if (x == 0) + return; + int *p = 0; + *p = 0xDEADBEEF; +} |