From b8111d54ed21818b9ae41b4f879e44bd435415da Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Mon, 26 Nov 2007 12:15:02 +0000 Subject: [PATCH] re PR rtl-optimization/34085 (ICE with -freorder-blocks-and-partition) Fix PR rtl-optimization/34085 Co-Authored-By: Revital Eres From-SVN: r130435 --- gcc/ChangeLog | 7 ++++ gcc/bb-reorder.c | 3 ++ gcc/testsuite/ChangeLog | 6 ++++ gcc/testsuite/gcc.dg/tree-prof/bb-reorg.c | 39 +++++++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-prof/bb-reorg.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a09dfff254b9..4a6466c988ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-11-26 Steven Bosscher + Revital Eres + + PR middle-end/34085 + * bb-reorder.c (insert_section_boundary_note): Clear + BLOCK_FOR_INSN in NOTE_INSN_SWITCH_TEXT_SECTIONS. + 2007-11-26 Richard Sandiford * config/mips/elfoabi.h (DRIVER_SELF_SPECS): Add missing comma. diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 0b7077171243..e997dc62b333 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -1947,6 +1947,9 @@ insert_section_boundary_note (void) { new_note = emit_note_before (NOTE_INSN_SWITCH_TEXT_SECTIONS, BB_HEAD (bb)); + /* ??? This kind of note always lives between basic blocks, + but add_insn_before will set BLOCK_FOR_INSN anyway. */ + BLOCK_FOR_INSN (new_note) = NULL; break; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f703706a43ff..cb45e6e8c172 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-11-26 Steven Bosscher + Revital Eres + + PR rtl-optimization/34085 + * gcc.dg/tree-prof (bb-reorg.c): New test. + 2007-11-26 Richard Sandiford * lib/target-supports.exp (check_effective_target_mips_soft_float): diff --git a/gcc/testsuite/gcc.dg/tree-prof/bb-reorg.c b/gcc/testsuite/gcc.dg/tree-prof/bb-reorg.c new file mode 100644 index 000000000000..f850c9bfd1e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-prof/bb-reorg.c @@ -0,0 +1,39 @@ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O2 -freorder-blocks-and-partition" } */ + +#include + +#define SIZE 1000 +int t0 = 0; +const char *t2[SIZE]; +char buf[SIZE]; + +void +foo (void) +{ + char *s = buf; + t0 = 1; + + for (;;) + { + if (*s == '\0') + break; + else + { + t2[t0] = s; + t0++; + } + *s++ = '\0'; + } + t2[t0] = NULL; +} + + +int +main () +{ + strcpy (buf, "hello"); + foo (); + return 0; +} + -- 2.47.2