[cfe-commits] r86286 - in /cfe/trunk/test/Analysis: PR3135.c misc-ps-region-store.m

Ted Kremenek kremenek at apple.com
Fri Nov 6 12:32:39 PST 2009


Author: kremenek
Date: Fri Nov  6 14:32:38 2009
New Revision: 86286

URL: http://llvm.org/viewvc/llvm-project?rev=86286&view=rev
Log:
testing: Merge PR3135.c into misc-ps-region-store.m.

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

Removed: cfe/trunk/test/Analysis/PR3135.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/PR3135.c?rev=86285&view=auto

==============================================================================
--- cfe/trunk/test/Analysis/PR3135.c (original)
+++ cfe/trunk/test/Analysis/PR3135.c (removed)
@@ -1,20 +0,0 @@
-// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s
-// PR3135
-
-typedef struct {
-  int *a;
-} structure;
-
-int bar(structure *x);
-
-int foo()
-{
-  int x;
-  structure y = {&x};
-
-  // the call to bar may initialize x
-  if (bar(&y) && x) // no-warning
-    return 1;
-
-  return 0;
-}

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=86286&r1=86285&r2=86286&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Fri Nov  6 14:32:38 2009
@@ -454,3 +454,19 @@
   return p; // expected-warning{{Returned pointer value points outside the original object}}
 }
 
+//===----------------------------------------------------------------------===//
+// PR 3135 - Test case that shows that a variable may get invalidated when its
+// address is included in a structure that is passed-by-value to an unknown function.
+//===----------------------------------------------------------------------===//
+
+typedef struct { int *a; } pr3135_structure;
+int pr3135_bar(pr3135_structure *x);
+int pr3135() {
+  int x;
+  pr3135_structure y = { &x };
+  // the call to pr3135_bar may initialize x
+  if (pr3135_bar(&y) && x) // no-warning
+    return 1;
+  return 0;
+}
+





More information about the cfe-commits mailing list