This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Crossjumping fix

> On Thu, Dec 06, 2001 at 12:16:05PM +0100, Jan Hubicka wrote:
> > 
> > Thu Dec  6 12:12:24 CET 2001  Jan Hubicka  <>
> > 
> > 	* cfgcleanup.c (flow_find_cross_jump): Replace tests for note
> > 	by active_insn_p; count conditional jump as instruction.
> This patch breaks c-torture/execute/920501-3.c on x86, because
> > !       /* Count everything except for unconditional jump as insn.  */
> > !       if (!simplejump_p (i1) && !returnjump_p (i1))
> > ! 	ninsns++;
> this test is true of an unconditional computed jump, not just a
> conditional jump.  We attempt to merge two basic blocks which have
> nothing in common, and reach the final set of loops (which are
> conditional on ninsns being nonzero) without last2 having been set to
> anything at all; null pointer dereference, crash.
The code runs into assumption that conditional that is simplejump has
eighter multiple outgoing edges and thus the following conditional will
set last2 as it must have also jump insn, or single outgoing edge and
then it is simplejump.

This sounds like resonable assumption for jumps and I think best fix
is to fix missfeature of redirect_edge_and_branch that should turn
the computed jump with single possible successor to uncondtional jump,
but rules out the abnormal edges too early.

I've bootstrapped/regtested the attached patch.

Looks OK?

Mon Dec 17 17:42:42 CET 2001  Jan Hubicka  <>
	* cfgrtl.c (redirect_edge_and_branch):  Do simplify abnormal
	edges resulting from computed jump
Index: cfgrtl.c
RCS file: /cvs/gcc/egcs/gcc/cfgrtl.c,v
retrieving revision 1.18
diff -c -3 -p -r1.18 cfgrtl.c
*** cfgrtl.c	2001/12/05 03:54:51	1.18
--- cfgrtl.c	2001/12/17 16:40:35
*************** redirect_edge_and_branch (e, target)
*** 792,798 ****
    basic_block src = e->src;
    rtx insn = src->end;
!   if (e->flags & EDGE_COMPLEX)
      return false;
    if (try_redirect_by_replacing_jump (e, target))
--- 792,798 ----
    basic_block src = e->src;
    rtx insn = src->end;
!   if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
      return false;
    if (try_redirect_by_replacing_jump (e, target))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]