From 4833f5615ea56f73106ca8537d0a8b50463fd164 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 19 Jul 2016 21:54:49 +0200 Subject: [PATCH] re PR rtl-optimization/71916 (ICE at -O3 on valid code on x86_64-linux-gnu in "maybe_record_trace_start") PR rtl-optimization/71916 * cfgrtl.c (contains_no_active_insn_p): Return false also for bb which have a single succ fake edge. * gcc.c-torture/compile/pr71916.c: New test. From-SVN: r238490 --- gcc/ChangeLog | 6 ++++ gcc/cfgrtl.c | 6 ++-- gcc/testsuite/ChangeLog | 3 ++ gcc/testsuite/gcc.c-torture/compile/pr71916.c | 36 +++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr71916.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35119514312..d3dfcc895a6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-07-19 Jakub Jelinek + + PR rtl-optimization/71916 + * cfgrtl.c (contains_no_active_insn_p): Return false also for + bb which have a single succ fake edge. + 2016-07-19 Aldy Hernandez PR debug/71855 diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 3d8ed60c2a0..e1f354e69fa 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -574,8 +574,10 @@ contains_no_active_insn_p (const_basic_block bb) { rtx_insn *insn; - if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || bb == ENTRY_BLOCK_PTR_FOR_FN (cfun) - || !single_succ_p (bb)) + if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun) + || bb == ENTRY_BLOCK_PTR_FOR_FN (cfun) + || !single_succ_p (bb) + || (single_succ_edge (bb)->flags & EDGE_FAKE) != 0) return false; for (insn = BB_HEAD (bb); insn != BB_END (bb); insn = NEXT_INSN (insn)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 17fcb00d1c8..ceae017ce8f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-07-19 Jakub Jelinek + PR rtl-optimization/71916 + * gcc.c-torture/compile/pr71916.c: New test. + PR middle-end/71874 * g++.dg/torture/pr71874.C: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71916.c b/gcc/testsuite/gcc.c-torture/compile/pr71916.c new file mode 100644 index 00000000000..95bc5b71f30 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr71916.c @@ -0,0 +1,36 @@ +/* PR rtl-optimization/71916 */ + +int a, b, c, d, f, g; +short h; + +short +foo (short p1) +{ + return a >= 2 || p1 > 7 >> a ? p1 : p1 << a; +} + +void +bar (void) +{ + for (;;) + { + int i, j[3]; + h = b >= 2 ? d : d >> b; + if (foo (f > h ^ c)) + { + d = 0; + while (f <= 2) + { + char k[2]; + for (;;) + k[i++] = 7; + } + } + else + for (;;) + g = j[2]; + if (g) + for (;;) + ; + } +} -- 2.30.2