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 PR69579


The following fixes PR69579.

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

Richard.

2016-02-01  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69579
	* tree-ssa-loop-ivcanon.c (propagate_constants_for_unrolling):
	Do not propagate through abnormal PHI results.

	* gcc.dg/setjmp-6.c: New testcase.

Index: gcc/tree-ssa-loop-ivcanon.c
===================================================================
--- gcc/tree-ssa-loop-ivcanon.c	(revision 232976)
+++ gcc/tree-ssa-loop-ivcanon.c	(working copy)
@@ -1208,7 +1208,9 @@ propagate_constants_for_unrolling (basic
       tree result = gimple_phi_result (phi);
       tree arg = gimple_phi_arg_def (phi, 0);
 
-      if (gimple_phi_num_args (phi) == 1 && TREE_CODE (arg) == INTEGER_CST)
+      if (! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (result)
+	  && gimple_phi_num_args (phi) == 1
+	  && TREE_CODE (arg) == INTEGER_CST)
 	{
 	  propagate_into_all_uses (result, arg);
 	  gsi_remove (&gsi, true);
Index: gcc/testsuite/gcc.dg/setjmp-6.c
===================================================================
--- gcc/testsuite/gcc.dg/setjmp-6.c	(revision 0)
+++ gcc/testsuite/gcc.dg/setjmp-6.c	(working copy)
@@ -0,0 +1,25 @@
+/* PR69569 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <setjmp.h>
+
+jmp_buf buf;
+
+struct str {
+    int Count;
+};
+int fun2(struct str *p1)
+{
+    int i = 1;
+    while (1) {
+	setjmp(buf);
+	break;
+    }
+    for (; i;) {
+	i = 0;
+	for (; i < (p1 ? p1->Count : 1); i++)
+	  fun2(p1);
+    }
+    return 1;
+}


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