]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/90898 (ICE in insert_clobber_before_stack_restore, at tree-ssa-ccp.c:2112)
authorJakub Jelinek <jakub@redhat.com>
Wed, 20 Nov 2019 09:53:15 +0000 (10:53 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 20 Nov 2019 09:53:15 +0000 (10:53 +0100)
PR c/90898
* tree-ssa-ccp.c (insert_clobber_before_stack_restore): Remove
assertion.
(insert_clobbers_for_var): Fix a typo in function comment.

* gcc.dg/pr90898.c: New test.

From-SVN: r278489

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr90898.c [new file with mode: 0644]
gcc/tree-ssa-ccp.c

index 4d03bdbe0af046ae0ed8d4606e4a12f4e0319217..83766ae2030368d85f6d77912ec6645e29b84318 100644 (file)
@@ -1,3 +1,10 @@
+2019-11-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/90898
+       * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Remove
+       assertion.
+       (insert_clobbers_for_var): Fix a typo in function comment.
+
 2019-11-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/91450
index 46dd927c0507212fd122f720b8cff605e588f10f..a0b764de8aa043ef370d6d0da5c6847a65b551c8 100644 (file)
@@ -1,5 +1,8 @@
 2019-11-20  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/90898
+       * gcc.dg/pr90898.c: New test.
+
        Backported from mainline
        2019-11-19  Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/gcc.dg/pr90898.c b/gcc/testsuite/gcc.dg/pr90898.c
new file mode 100644 (file)
index 0000000..e992ea3
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR c/90898 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void *p;
+int bar (void);
+void baz (int *);
+
+void
+foo (void)
+{
+  p = __builtin_stack_save ();
+  int a[(bar (), 2)];
+  baz (a);
+  __builtin_stack_restore (p);
+}
index e6bcc216e7cb9bfaec204158f0b24d16fbc7c186..8db6a34e05904889310e67a61e9970d2ca423ca0 100644 (file)
@@ -2079,8 +2079,6 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
     else if (gimple_assign_ssa_name_copy_p (stmt))
       insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
                                           visited);
-    else
-      gcc_assert (is_gimple_debug (stmt));
 }
 
 /* Advance the iterator to the previous non-debug gimple statement in the same
@@ -2105,9 +2103,9 @@ gsi_prev_dom_bb_nondebug (gimple_stmt_iterator *i)
 /* Find a BUILT_IN_STACK_SAVE dominating gsi_stmt (I), and insert
    a clobber of VAR before each matching BUILT_IN_STACK_RESTORE.
 
-   It is possible that BUILT_IN_STACK_SAVE cannot be find in a dominator when a
-   previous pass (such as DOM) duplicated it along multiple paths to a BB.  In
-   that case the function gives up without inserting the clobbers.  */
+   It is possible that BUILT_IN_STACK_SAVE cannot be found in a dominator when
+   a previous pass (such as DOM) duplicated it along multiple paths to a BB.
+   In that case the function gives up without inserting the clobbers.  */
 
 static void
 insert_clobbers_for_var (gimple_stmt_iterator i, tree var)