This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Fix PR target/27863: ICE in check_cfg, at haifa-sched.c:4615
- From: Maxim Kuvyrkov <mkuvyrkov at ispras dot ru>
- To: Vladimir Makarov <vmakarov at redhat dot com>
- Cc: Richard Guenther <rguenther at suse dot de>, Andrew Pinski <pinskia at physics dot uc dot edu>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 07 Jun 2006 20:37:51 +0400
- Subject: [PATCH]: Fix PR target/27863: ICE in check_cfg, at haifa-sched.c:4615
Hi!
This small patch fixes PR target/27863:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27863
The problem lies in the functions haifa-sched.c: unlink_line_note () and
unlink_other_notes (). They don't properly update basic block
boundaries when removing the note which is BB_END. This patch fixes that.
Thanks,
Maxim
2006-06-07 Maxim Kuvyrkov <mkuvyrkov@ispras.ru>
PR target/27863
* haifa-sched.c (unlink_other_notes, unlink_line_notes): Update basic
block boundaries.
--- haifa-sched.c (/gcc-local/trunk/gcc) (revision 20055)
+++ haifa-sched.c (/gcc-local/fix-pr27863/gcc) (revision 20055)
@@ -1243,12 +1243,22 @@ unlink_other_notes (rtx insn, rtx tail)
while (insn != tail && NOTE_NOT_BB_P (insn))
{
rtx next = NEXT_INSN (insn);
+ basic_block bb = BLOCK_FOR_INSN (insn);
+
/* Delete the note from its current position. */
if (prev)
NEXT_INSN (prev) = next;
if (next)
PREV_INSN (next) = prev;
+ /* Basic block can begin with either LABEL or
+ NOTE_INSN_BASIC_BLOCK. */
+ gcc_assert (BB_HEAD (bb) != insn);
+
+ /* Check if we are removing last insn in the BB. */
+ if (BB_END (bb) == insn)
+ BB_END (bb) = prev;
+
/* See sched_analyze to see how these are handled. */
if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_END)
@@ -1279,12 +1289,22 @@ unlink_line_notes (rtx insn, rtx tail)
if (write_symbols != NO_DEBUG && NOTE_LINE_NUMBER (insn) > 0)
{
+ basic_block bb = BLOCK_FOR_INSN (insn);
+
/* Delete the note from its current position. */
if (prev)
NEXT_INSN (prev) = next;
if (next)
PREV_INSN (next) = prev;
+ /* Basic block can begin with either LABEL or
+ NOTE_INSN_BASIC_BLOCK. */
+ gcc_assert (BB_HEAD (bb) != insn);
+
+ /* Check if we are removing last insn in the BB. */
+ if (BB_END (bb) == insn)
+ BB_END (bb) = prev;
+
/* Record line-number notes so they can be reused. */
LINE_NOTE (insn) = insn;
}