re PR tree-optimization/83685 (ICE: SSA corruption)
authorRichard Biener <rguenther@suse.de>
Mon, 8 Jan 2018 13:22:56 +0000 (13:22 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 8 Jan 2018 13:22:56 +0000 (13:22 +0000)
2018-01-08  Richard Biener  <rguenther@suse.de>

PR tree-optimization/83685
* tree-ssa-pre.c (create_expression_by_pieces): Do not insert
references to abnormals.

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

From-SVN: r256339

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr83685.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index 0c9d6947d68a8df89592cc41a9800bb0fb479ba0..cbd431aed83d6703b9b6f036648e3022bcd3b045 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-08  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83685
+       * tree-ssa-pre.c (create_expression_by_pieces): Do not insert
+       references to abnormals.
+
 2018-01-08  Richard Biener  <rguenther@suse.de>
 
        PR lto/83719
index ccc94d1b2a699542cc68dcba4fec8faa7e22cf95..25f82aea1f61d529361315364aa170b20654612a 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-08  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83685
+       * gcc.dg/torture/pr83685.c: New testcase.
+
 2018-01-08  Richard Biener  <rguenther@suse.de>
 
        PR lto/83719
diff --git a/gcc/testsuite/gcc.dg/torture/pr83685.c b/gcc/testsuite/gcc.dg/torture/pr83685.c
new file mode 100644 (file)
index 0000000..062f75d
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile }  */
+
+int _setjmp (void *);
+void foo (int);
+
+void
+bar (int e, int b, char c, void *d)
+{
+  while (b)
+    {
+      if (_setjmp (d))
+       foo (e);
+      if (c)
+       {
+         e--;
+         foo (0);
+       }
+      e++;
+    }
+}
index 63c2a6a209bf5edadabf419def69cd2cd5ed0a72..55295e171e9e48d3538205b066f7c0e9309ac77e 100644 (file)
@@ -2697,6 +2697,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
        that value numbering saw through.  */
     case NAME:
       folded = PRE_EXPR_NAME (expr);
+      if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (folded))
+       return NULL_TREE;
       if (useless_type_conversion_p (exprtype, TREE_TYPE (folded)))
        return folded;
       break;