[cfe-commits] r95479 - in /cfe/trunk: lib/Checker/RegionStore.cpp test/Analysis/misc-ps.m

Ted Kremenek kremenek at apple.com
Fri Feb 5 20:04:47 PST 2010


Author: kremenek
Date: Fri Feb  5 22:04:46 2010
New Revision: 95479

URL: http://llvm.org/viewvc/llvm-project?rev=95479&view=rev
Log:
Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are implicitly initialized to NULL.

Modified:
    cfe/trunk/lib/Checker/RegionStore.cpp
    cfe/trunk/test/Analysis/misc-ps.m

Modified: cfe/trunk/lib/Checker/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/RegionStore.cpp?rev=95479&r1=95478&r2=95479&view=diff

==============================================================================
--- cfe/trunk/lib/Checker/RegionStore.cpp (original)
+++ cfe/trunk/lib/Checker/RegionStore.cpp Fri Feb  5 22:04:46 2010
@@ -1407,7 +1407,9 @@
 
     if (T->isIntegerType())
       return ValMgr.makeIntVal(0, T);
-    
+    if (T->isPointerType())
+      return ValMgr.makeNull();
+
     return UnknownVal();    
   }
     

Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=95479&r1=95478&r2=95479&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Fri Feb  5 22:04:46 2010
@@ -908,3 +908,10 @@
   int *p = 0;
   *p = 0xDEADBEEF;
 }
+void rdar7582031_test_static_init_zero_b() {
+  static void* x;
+  if (x == 0)
+    return;
+  int *p = 0;
+  *p = 0xDEADBEEF;
+}





More information about the cfe-commits mailing list