re PR rtl-optimization/34085 (ICE with -freorder-blocks-and-partition)
authorSteven Bosscher <stevenb.gcc@gmail.com>
Mon, 26 Nov 2007 12:15:02 +0000 (12:15 +0000)
committerRevital Eres <revitale@gcc.gnu.org>
Mon, 26 Nov 2007 12:15:02 +0000 (12:15 +0000)
Fix PR rtl-optimization/34085

Co-Authored-By: Revital Eres <eres@il.ibm.com>
From-SVN: r130435

gcc/ChangeLog
gcc/bb-reorder.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-prof/bb-reorg.c [new file with mode: 0644]

index a09dfff..4a6466c 100644 (file)
@@ -1,3 +1,10 @@
+2007-11-26  Steven Bosscher  <stevenb.gcc@gmail.com> 
+           Revital Eres  <eres@il.ibm.com> 
+
+       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  <rsandifo@nildram.co.uk>
 
        * config/mips/elfoabi.h (DRIVER_SELF_SPECS): Add missing comma.
index 0b70771..e997dc6 100644 (file)
@@ -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;
        }
     }
index f703706..cb45e6e 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-26  Steven Bosscher  <stevenb.gcc@gmail.com>
+           Revital Eres  <eres@il.ibm.com>
+
+       PR rtl-optimization/34085
+       * gcc.dg/tree-prof (bb-reorg.c): New test.
+
 2007-11-26  Richard Sandiford  <rsandifo@nildram.co.uk>
 
        * 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 (file)
index 0000000..f850c9b
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-require-effective-target freorder } */
+/* { dg-options "-O2 -freorder-blocks-and-partition" } */
+
+#include <string.h>
+
+#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; 
+}
+