diff mbox

Fix pr/59924

Message ID 20140204004745.GA12671@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Feb. 4, 2014, 12:47 a.m. UTC
On Mon, Feb 03, 2014 at 03:18:49PM -0800, Richard Henderson wrote:
> The problem with this pr is that the -uninit pass could get itself
> into a loop while processing nodes.  Within this loop, it would
> allocate memory, therefore the visible symptom was allocation
> failure instead of a non-terminating loop.
> 
> Amusingly, the case that prods the -uninit pass into this behaviour
> contains an uninitialized variable.

Thanks.

> I briefly tried to produce a reduced test case, but didn't manage
> to do so.  The one in the PR is a bit big to commit...

I've committed a testcase for this, delta can do wonders :)

2014-02-04  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/59924
	* gcc.dg/pr59924.c: New test.


	Jakub
diff mbox

Patch

--- gcc/testsuite/gcc.dg/pr59924.c.jj	2014-02-04 01:42:43.691929830 +0100
+++ gcc/testsuite/gcc.dg/pr59924.c	2014-02-04 01:42:24.000000000 +0100
@@ -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);
+    }
+}