[cfe-commits] r62772 - in /cfe/trunk/test/Analysis: misc-ps-basic-store.m misc-ps-region-store.m misc-ps.m

Ted Kremenek kremenek at apple.com
Thu Jan 22 10:53:15 PST 2009


Author: kremenek
Date: Thu Jan 22 12:53:15 2009
New Revision: 62772

URL: http://llvm.org/viewvc/llvm-project?rev=62772&view=rev
Log:
The 'misc-ps.m' test case now passes with RegionStore.  One case needed to be split out into 'misc-ps-basic-store.m' and 'misc-ps-region-store.m' because the behavior was different between the two store models (RegionStore flags an additional valid bug).

Added:
    cfe/trunk/test/Analysis/misc-ps-basic-store.m
    cfe/trunk/test/Analysis/misc-ps-region-store.m
Modified:
    cfe/trunk/test/Analysis/misc-ps.m

Added: cfe/trunk/test/Analysis/misc-ps-basic-store.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-basic-store.m?rev=62772&view=auto

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-basic-store.m (added)
+++ cfe/trunk/test/Analysis/misc-ps-basic-store.m Thu Jan 22 12:53:15 2009
@@ -0,0 +1,21 @@
+// RUN: clang -analyze -checker-cfref --analyzer-store-basic --verify -fblocks %s
+
+//---------------------------------------------------------------------------
+// Test case 'checkaccess_union' differs for region store and basic store.
+// The basic store doesn't reason about compound literals, so the code
+// below won't fire an "uninitialized value" warning.
+//---------------------------------------------------------------------------
+
+// PR 2948 (testcase; crash on VisitLValue for union types)
+// http://llvm.org/bugs/show_bug.cgi?id=2948
+
+void checkaccess_union() {
+  int ret = 0, status;
+  if (((((__extension__ (((union {  // no-warning
+    __typeof (status) __in; int __i;}
+    )
+    {
+      .__in = (status)}
+      ).__i))) & 0xff00) >> 8) == 1)
+        ret = 1;
+}

Added: cfe/trunk/test/Analysis/misc-ps-region-store.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.m?rev=62772&view=auto

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (added)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Thu Jan 22 12:53:15 2009
@@ -0,0 +1,21 @@
+// RUN: clang -analyze -checker-cfref --analyzer-store-region --verify -fblocks %s
+
+//---------------------------------------------------------------------------
+// Test case 'checkaccess_union' differs for region store and basic store.
+// The basic store doesn't reason about compound literals, so the code
+// below won't fire an "uninitialized value" warning.
+//---------------------------------------------------------------------------
+
+// PR 2948 (testcase; crash on VisitLValue for union types)
+// http://llvm.org/bugs/show_bug.cgi?id=2948
+
+void checkaccess_union() {
+  int ret = 0, status;
+  if (((((__extension__ (((union {  // expected-warning {{ Branch condition evaluates to an uninitialized value.}}
+    __typeof (status) __in; int __i;}
+    )
+    {
+      .__in = (status)}
+      ).__i))) & 0xff00) >> 8) == 1)
+        ret = 1;
+}

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

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Thu Jan 22 12:53:15 2009
@@ -1,4 +1,6 @@
-// RUN: clang -analyze -checker-cfref --verify -fblocks %s
+// RUN: clang -analyze -checker-cfref --analyzer-store-basic --verify -fblocks %s &&
+// RUN: clang -analyze -checker-cfref --analyzer-store-region --verify -fblocks %s
+
 
 // Reduced test case from crash in <rdar://problem/6253157>
 @class NSObject;
@@ -43,20 +45,6 @@
   if (j == 0) x = x / 0;  // no-warning
 }
 
-// PR 2948 (testcase; crash on VisitLValue for union types)
-// http://llvm.org/bugs/show_bug.cgi?id=2948
-
-void checkaccess_union() {
-  int ret = 0, status;
-  if (((((__extension__ (((union {
-    __typeof (status) __in; int __i;}
-    )
-    {
-      .__in = (status)}
-      ).__i))) & 0xff00) >> 8) == 1)
-        ret = 1;
-}
-
 // InitListExpr processing
 
 typedef float __m128 __attribute__((__vector_size__(16), __may_alias__));





More information about the cfe-commits mailing list