re PR tree-optimization/59924 (uninit memory hog)
authorJakub Jelinek <jakub@redhat.com>
Tue, 4 Feb 2014 00:46:42 +0000 (01:46 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 4 Feb 2014 00:46:42 +0000 (01:46 +0100)
PR tree-optimization/59924
* gcc.dg/pr59924.c: New test.

From-SVN: r207446

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr59924.c [new file with mode: 0644]

index e14976b..9465477 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/59924
+       * gcc.dg/pr59924.c: New test.
+
 2014-02-03  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/59831
diff --git a/gcc/testsuite/gcc.dg/pr59924.c b/gcc/testsuite/gcc.dg/pr59924.c
new file mode 100644 (file)
index 0000000..1d8d52f
--- /dev/null
@@ -0,0 +1,27 @@
+/* PR tree-optimization/59924 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -Wall" } */
+
+struct S { struct T *a; double b; struct S *c; };
+struct T { struct S *d; };
+extern void bar (double);
+
+void
+foo (struct S * x, int y, int z, int w)
+{
+  int e;
+  struct S *f;
+  for (f = x->a->d; f; f = f->c)
+    {
+      if (5 < w)
+       {
+         e = -w;
+         z = w;
+       }
+    }
+  if (y != 0 || z != 0)
+    {
+      double g = x->b + (double) e * (double) y; /* { dg-warning "may be used uninitialized in this function" } */
+      bar (g * g);
+    }
+}