This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR64728


The following fixes PR64728 - with the change to aggressively
propagate uninitialized abnormal SSA names we have to avoid
coalescing that with anything (we'll just expand it to whatever
the rest of the args was coalesced with).

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2015-01-22  Richard Biener  <rguenther@suse.de>

	PR middle-end/64728
	* tree-ssa-coalesce.c (coalesce_partitions): Do not perform
	abnormal coalescing on undefined SSA names.

	* gcc.dg/torture/pr64728.c: New testcase.

Index: gcc/testsuite/gcc.dg/torture/pr64728.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr64728.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr64728.c	(working copy)
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+#include <setjmp.h>
+
+jmp_buf a;
+int b, d;
+void baz (long);
+
+static void
+bar (long *x)
+{
+  if (d)
+    *x = b;
+}
+
+void
+foo ()
+{
+  baz (0);
+  if (setjmp (a))
+    {
+      long c;
+      bar (&c);
+      baz (c);
+    }
+  baz (0);
+}
Index: gcc/tree-ssa-coalesce.c
===================================================================
--- gcc/tree-ssa-coalesce.c	(revision 219994)
+++ gcc/tree-ssa-coalesce.c	(working copy)
@@ -1213,8 +1213,13 @@ coalesce_partitions (var_map map, ssa_co
 		 gsi_next (&gsi))
 	      {
 		gphi *phi = gsi.phi ();
+		tree arg = PHI_ARG_DEF (phi, e->dest_idx);
+		if (SSA_NAME_IS_DEFAULT_DEF (arg)
+		    && (!SSA_NAME_VAR (arg)
+			|| TREE_CODE (SSA_NAME_VAR (arg)) != PARM_DECL))
+		  continue;
+
 		tree res = PHI_RESULT (phi);
-	        tree arg = PHI_ARG_DEF (phi, e->dest_idx);
 		int v1 = SSA_NAME_VERSION (res);
 		int v2 = SSA_NAME_VERSION (arg);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]