This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix RTL checking failure in fix_crossing_unconditional_branches
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 21 Oct 2005 21:42:49 +0200
- Subject: [PATCH] Fix RTL checking failure in fix_crossing_unconditional_branches
I'm the only one who tests with RTL checking enabled or...?
With the command line
gcc -g -fprofile-use -freorder-blocks-and-partition attribs.i
I get on SPARC:
/home/eric/cvs/gcc/gcc/attribs.c: In function 'decl_attributes':
/home/eric/cvs/gcc/gcc/attribs.c:332: internal compiler error: RTL check:
expected elt 3 type 'B', have '0' (rtx barrier) in
fix_crossing_unconditional_branches, at bb-reorder.c:1742
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
/* Generate indirect the jump sequence. */
start_sequence ();
emit_move_insn (new_reg, label_addr);
emit_indirect_jump (new_reg);
indirect_jump_sequence = get_insns ();
end_sequence ();
/* Make sure every instruction in the new jump sequence has
its basic block set to be cur_bb. */
for (cur_insn = indirect_jump_sequence; cur_insn;
cur_insn = NEXT_INSN (cur_insn))
{
BLOCK_FOR_INSN (cur_insn) = cur_bb; <--- 1742
if (JUMP_P (cur_insn))
jump_insn = cur_insn;
}
cur_insn is a BARRIER, emitted by the call to emit_indirect_jump:
void
emit_indirect_jump (rtx loc)
{
if (!insn_data[(int) CODE_FOR_indirect_jump].operand[0].predicate
(loc, Pmode))
loc = copy_to_mode_reg (Pmode, loc);
emit_jump_insn (gen_indirect_jump (loc));
emit_barrier ();
}
The code in emit_indirect_jump goes back to rev1.1, the code in
fix_crossing_unconditional_branches has been unmodified since 09-Apr-04.
Because of that, I cannot profiledbootstrap mainline on SPARC, a regression
from 4.0 branch. OK for mainline?
2005-10-21 Eric Botcazou <ebotcazou@libertysurf.fr>
PR rtl-optimization/24460
* bb-reorder.c (fix_crossing_unconditional_branches): Stop on the
barrier when setting the basic block for new instructions.
--
Eric Botcazou
Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
retrieving revision 1.114
diff -u -p -r1.114 bb-reorder.c
--- bb-reorder.c 5 Oct 2005 19:11:42 -0000 1.114
+++ bb-reorder.c 21 Oct 2005 19:37:27 -0000
@@ -1736,7 +1736,7 @@ fix_crossing_unconditional_branches (voi
/* Make sure every instruction in the new jump sequence has
its basic block set to be cur_bb. */
- for (cur_insn = indirect_jump_sequence; cur_insn;
+ for (cur_insn = indirect_jump_sequence; !BARRIER_P (cur_insn);
cur_insn = NEXT_INSN (cur_insn))
{
BLOCK_FOR_INSN (cur_insn) = cur_bb;