re PR tree-optimization/69579 (gcc ICE at -O3 and __sigsetjmp with “tree check: expec...
authorRichard Biener <rguenther@suse.de>
Mon, 1 Feb 2016 12:39:04 +0000 (12:39 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 1 Feb 2016 12:39:04 +0000 (12:39 +0000)
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.

From-SVN: r233036

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/setjmp-6.c [new file with mode: 0644]
gcc/tree-ssa-loop-ivcanon.c

index d793391f2387b59cb54061f5622f0eae9fc6c0b0..c40db1e4194e8200133c0f90a41648e9088cced4 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2016-02-01  Eric Botcazou  <ebotcazou@adacore.com>
 
        * postreload.c (reload_cse_simplify): Remove dead code.
index 6462028e62edbbb975723fb1605dbd1cd03cd786..0c1df5e3aa65383a79c1fc34448d5d8664f8b323 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69579
+       * gcc.dg/setjmp-6.c: New testcase.
+
 2016-02-01  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/69570
diff --git a/gcc/testsuite/gcc.dg/setjmp-6.c b/gcc/testsuite/gcc.dg/setjmp-6.c
new file mode 100644 (file)
index 0000000..0781f05
--- /dev/null
@@ -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 628d5b1ce47fcd08800ca5eb89c2ac3ef08d11eb..ab1f7e6d7a9f3dd7df46dc45c94d0f6f18988910 100644 (file)
@@ -1208,7 +1208,9 @@ propagate_constants_for_unrolling (basic_block bb)
       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);