]> granicus.if.org Git - clang/commitdiff
Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are implicitly...
authorTed Kremenek <kremenek@apple.com>
Sat, 6 Feb 2010 04:04:46 +0000 (04:04 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 6 Feb 2010 04:04:46 +0000 (04:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95479 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/RegionStore.cpp
test/Analysis/misc-ps.m

index 2e212db3e628194f03ed432f7764b0d6655b5399..36022d57376dbb0f79217185a626f2a2a09d5ea4 100644 (file)
@@ -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();    
   }
     
index c1b3d9788b2299d715606f75777d29c8688507cc..20eed9cb3de09a68d4d47418d23e2f1cff5919d6 100644 (file)
@@ -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;
+}