[cfe-commits] r96902 - /cfe/trunk/test/Analysis/misc-ps-region-store.m

Ted Kremenek kremenek at apple.com
Mon Feb 22 23:17:57 PST 2010


Author: kremenek
Date: Tue Feb 23 01:17:57 2010
New Revision: 96902

URL: http://llvm.org/viewvc/llvm-project?rev=96902&view=rev
Log:
Add test case for <rdar://problem/7242010>, which appears to have been fixed
in the recent changes to RegionStore::InvalidateRegions().  Note that we
are still not yet modeling 'memcpy()' explicitly.

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

Modified: 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=96902&r1=96901&r2=96902&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Tue Feb 23 01:17:57 2010
@@ -1,6 +1,10 @@
 // RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks   -analyzer-opt-analyze-nested-blocks %s
 
+typedef long unsigned int size_t;
+void *memcpy(void *, const void *, size_t);
+void *alloca(size_t);
+
 typedef struct objc_selector *SEL;
 typedef signed char BOOL;
 typedef int NSInteger;
@@ -867,3 +871,20 @@
   test_a_rev96062_aux2(&z);
   return a + b; // no-warning
 }
+
+//===----------------------------------------------------------------------===//
+// <rdar://problem/7242010> - The access to y[0] at the bottom previously
+//  was reported as an uninitialized value.
+//===----------------------------------------------------------------------===//
+
+char *rdar_7242010(int count, char **y) {
+  char **x = alloca((count + 4) * sizeof(*x));
+  x[0] = "hi";
+  x[1] = "there";
+  x[2] = "every";
+  x[3] = "body";
+  memcpy(x + 4, y, count * sizeof(*x));
+  y = x;
+  return y[0]; // no-warning
+}
+





More information about the cfe-commits mailing list