Patchwork Fix PR57287

login
register
mail settings
Submitter Richard Guenther
Date May 24, 2013, 11:03 a.m.
Message ID <alpine.LNX.2.00.1305241302450.24881@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/246131/
State New
Headers show

Comments

Richard Guenther - May 24, 2013, 11:03 a.m.
After spending some time to try retaining some abnormal SSA name
uninitialized uses I gave up and just punt like below.

Bootstrap / regtest running on x86_64-unknown-linux-gnu.

Richard.

2013-05-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/57287
	* tree-ssa-uninit.c (compute_uninit_opnds_pos): Disregard
	all SSA names that occur in abnormal PHIs.

	* gcc.dg/pr57287.c: New testcase.

Patch

Index: gcc/tree-ssa-uninit.c
===================================================================
--- gcc/tree-ssa-uninit.c	(revision 199284)
+++ gcc/tree-ssa-uninit.c	(working copy)
@@ -165,17 +165,12 @@  compute_uninit_opnds_pos (gimple phi)
           && uninit_undefined_value_p (op)
           && !can_skip_redundant_opnd (op, phi))
 	{
-	  /* Ignore SSA_NAMEs on abnormal edges to setjmp
-	     or nonlocal goto receiver.  */
           if (cfun->has_nonlocal_label || cfun->calls_setjmp)
 	    {
-	      edge e = gimple_phi_arg_edge (phi, i);
-	      if (e->flags & EDGE_ABNORMAL)
-		{
-		  gimple last = last_stmt (e->src);
-		  if (last && stmt_can_make_abnormal_goto (last))
-		    continue;
-		}
+	      /* Ignore SSA_NAMEs that appear on abnormal edges
+		 somewhere.  */
+	      if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op))
+		continue;
 	    }
 	  MASK_SET_BIT (uninit_opnds, i);
 	}
Index: gcc/testsuite/gcc.dg/pr57287.c
===================================================================
--- gcc/testsuite/gcc.dg/pr57287.c	(revision 0)
+++ gcc/testsuite/gcc.dg/pr57287.c	(working copy)
@@ -0,0 +1,24 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+
+#include <setjmp.h>
+
+jmp_buf buf;
+
+void foo (int);
+void bar (int) __attribute__((leaf));
+
+void enumerate_locals (int indent)
+{
+  foo (0);
+  while (indent--)
+    {
+      int local_indent = 8 + (8 * indent);
+      if (local_indent != 8)
+	{
+	  setjmp (buf);
+	  bar (local_indent);  /* { dg-bogus "may be used uninitialized" "" } */
+	}
+    }
+  foo (1);
+}