aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-05-31 09:53:48 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-05-31 09:53:48 +0200
commit6992d6fbf2ffdb4a5c78604fbf33ae95956fffdd (patch)
tree60a8f12d775717b56975226f009fb27e15718573 /gcc
parent0eee8eaa834181720cfb4e360a1c69d77c74b552 (diff)
downloadgcc-6992d6fbf2ffdb4a5c78604fbf33ae95956fffdd.zip
gcc-6992d6fbf2ffdb4a5c78604fbf33ae95956fffdd.tar.gz
gcc-6992d6fbf2ffdb4a5c78604fbf33ae95956fffdd.tar.bz2
re PR tree-optimization/90671 (ICE on valid code at -Os and above with -g enabled in gsi_split_seq_after, at gimple-iterator.c:345)
PR tree-optimization/90671 * tree-ssa-threadupdate.c (ssa_create_duplicates): If template_block used to be empty on the first call, don't use gsi_split_seq_after and gsi_insert_seq_after, but remember whole seq with bb_seq and set it with set_bb_seq. * gcc.dg/torture/pr90671.c: New test. From-SVN: r271802
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr90671.c16
-rw-r--r--gcc/tree-ssa-threadupdate.c19
4 files changed, 45 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e3792c6..5283fed 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2019-05-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/90671
+ * tree-ssa-threadupdate.c (ssa_create_duplicates): If
+ template_block used to be empty on the first call, don't use
+ gsi_split_seq_after and gsi_insert_seq_after, but remember whole
+ seq with bb_seq and set it with set_bb_seq.
+
2019-05-31 Iain Sandoe <iain@sandoe.co.uk>
* config/i386/darwin.h (ASM_OUTPUT_MAX_SKIP_ALIGN): New.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 341dc4c..c081448 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/90671
+ * gcc.dg/torture/pr90671.c: New test.
+
2019-05-31 Iain Sandoe <iain@sandoe.co.uk>
* g++.dg/cpp0x/pr84497.C: Require alias support.
diff --git a/gcc/testsuite/gcc.dg/torture/pr90671.c b/gcc/testsuite/gcc.dg/torture/pr90671.c
new file mode 100644
index 0000000..5a99b9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr90671.c
@@ -0,0 +1,16 @@
+/* PR tree-optimization/90671 */
+/* { dg-do compile } */
+/* { dg-additional-options "-w -g" } */
+
+int a;
+
+int
+main ()
+{
+ int b, c;
+ for (c = 0; c < 2; c++)
+ while (a)
+ if (b)
+ break;
+ return 0;
+}
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index d631543..a56ccfb 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -1142,12 +1142,25 @@ ssa_create_duplicates (struct redirection_data **slot,
gimple_seq seq = NULL;
if (gsi_stmt (local_info->template_last_to_copy)
!= gsi_stmt (gsi_last_bb (local_info->template_block)))
- seq = gsi_split_seq_after (local_info->template_last_to_copy);
+ {
+ if (gsi_end_p (local_info->template_last_to_copy))
+ {
+ seq = bb_seq (local_info->template_block);
+ set_bb_seq (local_info->template_block, NULL);
+ }
+ else
+ seq = gsi_split_seq_after (local_info->template_last_to_copy);
+ }
create_block_for_threading (local_info->template_block, rd, 0,
&local_info->duplicate_blocks);
if (seq)
- gsi_insert_seq_after (&local_info->template_last_to_copy,
- seq, GSI_SAME_STMT);
+ {
+ if (gsi_end_p (local_info->template_last_to_copy))
+ set_bb_seq (local_info->template_block, seq);
+ else
+ gsi_insert_seq_after (&local_info->template_last_to_copy,
+ seq, GSI_SAME_STMT);
+ }
/* Go ahead and wire up outgoing edges and update PHIs for the duplicate
block. */