flow bug
Richard Henderson
rth@cygnus.com
Tue Mar 9 00:11:00 GMT 1999
On Mon, Mar 08, 1999 at 11:04:02PM -0700, Jeffrey A Law wrote:
> debug_rtx_list (NEXT_INSN (b->end), 100) shows:
>
> (code_label 10 9 20 3 ("101"))
>
> (note 20 10 15 [bb 1] NOTE_INSN_BASIC_BLOCK)
>
> (note 15 20 0 0 NOTE_INSN_BLOCK_END)
>
> So next_nonnote_insn (q) returns null. Then we try to examine the code
> of Q, which causes the segfault.
I think as well we need the same cc0 check that you put in for
merge_blocks_nomove.
I'm gonna bootstrap several machines before I put this in.
r~
* flow.c (tidy_fallthru_edge): Be more careful finding the last
BARRIER of a list. Delete the cc0 setter as well as a cond jump.
Index: flow.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/flow.c,v
retrieving revision 1.104
diff -c -p -d -r1.104 flow.c
*** flow.c 1999/03/08 14:40:47 1.104
--- flow.c 1999/03/09 08:08:07
*************** tidy_fallthru_edge (e, b, c)
*** 1933,1939 ****
edge e;
basic_block b, c;
{
! rtx p, q, h;
/* ??? In a late-running flow pass, other folks may have deleted basic
blocks by nopping out blocks, leaving multiple BARRIERs between here
--- 1933,1939 ----
edge e;
basic_block b, c;
{
! rtx q, h;
/* ??? In a late-running flow pass, other folks may have deleted basic
blocks by nopping out blocks, leaving multiple BARRIERs between here
*************** tidy_fallthru_edge (e, b, c)
*** 1943,1954 ****
barriers and notes. */
q = NEXT_INSN (b->end);
! do
! {
! p = q;
! q = next_nonnote_insn (q);
! }
! while (GET_CODE (q) == BARRIER);
/* Assert that we now actually do fall through. */
h = c->head;
--- 1943,1952 ----
barriers and notes. */
q = NEXT_INSN (b->end);
! if (q && GET_CODE (q) == NOTE)
! q = next_nonnote_insn (q);
! while (q && GET_CODE (q) == BARRIER)
! q = next_nonnote_insn (q);
/* Assert that we now actually do fall through. */
h = c->head;
*************** tidy_fallthru_edge (e, b, c)
*** 1963,1968 ****
--- 1961,1973 ----
q = b->end;
if (GET_CODE (q) == JUMP_INSN)
{
+ #ifdef HAVE_cc0
+ /* If this was a conditional jump, we need to also delete
+ the insn that set cc0. */
+ if (! simplejump_p (q) && condjump_p (q))
+ q = PREV_INSN (q);
+ #endif
+
if (b->head == q)
{
PUT_CODE (q, NOTE);
*************** tidy_fallthru_edge (e, b, c)
*** 1974,1980 ****
}
/* Selectively unlink the sequence. */
! delete_insn_chain (NEXT_INSN (q), p);
e->flags |= EDGE_FALLTHRU;
}
--- 1979,1986 ----
}
/* Selectively unlink the sequence. */
! if (q != PREV_INSN (c->head))
! delete_insn_chain (NEXT_INSN (q), PREV_INSN (c->head));
e->flags |= EDGE_FALLTHRU;
}
More information about the Gcc-patches
mailing list