[cfe-commits] r62816 - in /cfe/trunk: lib/Analysis/RegionStore.cpp test/Analysis/NoReturn.m test/Analysis/rdar-6442306-1.m

Ted Kremenek kremenek at apple.com
Thu Jan 22 15:56:57 PST 2009


Author: kremenek
Date: Thu Jan 22 17:56:56 2009
New Revision: 62816

URL: http://llvm.org/viewvc/llvm-project?rev=62816&view=rev
Log:
For now, return UnknownVal() in RegionStore::getElementsSize() for AnonTypedRegions.  It wasn't really doing the right thing and was crashing on rdar-6442306-1.m.  This fix causes all path-sensitive test cases to pass with RegionStore.

Modified:
    cfe/trunk/lib/Analysis/RegionStore.cpp
    cfe/trunk/test/Analysis/NoReturn.m
    cfe/trunk/test/Analysis/rdar-6442306-1.m

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

==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Thu Jan 22 17:56:56 2009
@@ -420,6 +420,12 @@
   }
 
   if (const AnonTypedRegion* ATR = dyn_cast<AnonTypedRegion>(R)) {
+#if 0
+    // FIXME: This logic doesn't really work, as we can have all sorts of
+    // weird cases.  For example, this crashes on test case 'rdar-6442306-1.m'.
+    // The weird cases come in when arbitrary casting comes into play, violating
+    // any type-safe programming.
+    
     GRStateRef state(St, StateMgr);
 
     // Get the size of the super region in bytes.
@@ -450,6 +456,10 @@
       (SSize * getBasicVals().getValue(8, SSize.getBitWidth(), false)) / ESize;
 
     return NonLoc::MakeVal(getBasicVals(), S);
+#else
+    ATR = ATR;
+    return UnknownVal();
+#endif
   }
 
   if (const FieldRegion* FR = dyn_cast<FieldRegion>(R)) {

Modified: cfe/trunk/test/Analysis/NoReturn.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/NoReturn.m?rev=62816&r1=62815&r2=62816&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/NoReturn.m (original)
+++ cfe/trunk/test/Analysis/NoReturn.m Thu Jan 22 17:56:56 2009
@@ -1,5 +1,6 @@
-// RUN: clang -analyze -checker-simple -verify %s &&
-// RUN: clang -analyze -checker-cfref -verify %s
+// RUN: clang -analyze -checker-simple -analyzer-store-basic -verify %s &&
+// RUN: clang -analyze -checker-cfref -analyzer-store-basic -verify %s &&
+// RUN: clang -analyze -checker-cfref -analyzer-store-region -verify %s
 
 #include <stdarg.h>
 

Modified: cfe/trunk/test/Analysis/rdar-6442306-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/rdar-6442306-1.m?rev=62816&r1=62815&r2=62816&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/rdar-6442306-1.m (original)
+++ cfe/trunk/test/Analysis/rdar-6442306-1.m Thu Jan 22 17:56:56 2009
@@ -1,5 +1,5 @@
-// RUN: clang -analyze -checker-cfref %s --analyzer-store-basic -verify
-// DISABLE: clang -analyze -checker-cfref %s --analyzer-store-region -verify
+// RUN: clang -analyze -checker-cfref %s --analyzer-store-basic -verify &&
+// RUN: clang -analyze -checker-cfref %s --analyzer-store-region -verify
 
 typedef int bar_return_t;
 typedef struct {





More information about the cfe-commits mailing list