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 | bdfcacbe8f6631360243c0ff8429c06f77a1aa94 (patch) | |
tree | 1f0f88ada9078d4345599097575c64ee9c73e9c8 | |
parent | 30fe9ecac23bc5f9b6ec0af088c0cea94f167687 (diff) | |
download | bcm5719-llvm-bdfcacbe8f6631360243c0ff8429c06f77a1aa94.tar.gz bcm5719-llvm-bdfcacbe8f6631360243c0ff8429c06f77a1aa94.zip |
Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are implicitly initialized to NULL.
llvm-svn: 95479
-rw-r--r-- | clang/lib/Checker/RegionStore.cpp | 4 | ||||
-rw-r--r-- | clang/test/Analysis/misc-ps.m | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Checker/RegionStore.cpp b/clang/lib/Checker/RegionStore.cpp index 2e212db3e62..36022d57376 100644 --- a/clang/lib/Checker/RegionStore.cpp +++ b/clang/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/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m index c1b3d9788b2..20eed9cb3de 100644 --- a/clang/test/Analysis/misc-ps.m +++ b/clang/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; +} |