tetex mis-compilation fix

Jeffrey A Law law@cygnus.com
Wed Aug 4 00:16:00 GMT 1999


As I mentioned a couple days ago, the problem was the new cfg code is not
being as careful as it should be when presented with a conditional branch
that has additional side effects which happens to jump to the next block.
It would delete the branch, which lost the other side effect. 

The fix (of course) is to not delete a jump that potentially has other
side effects.

	* flow.c (delete_unreachable_blocks): Do not call merge_blocks
	or tidy_fallthru_edge if the last insn in the block is not
	an unconditional jump or a simple conditional jump.

Index: flow.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/flow.c,v
retrieving revision 1.120.4.3
diff -c -3 -p -r1.120.4.3 flow.c
*** flow.c	1999/07/01 23:49:45	1.120.4.3
--- flow.c	1999/08/04 07:07:17
*************** delete_unreachable_blocks ()
*** 1562,1568 ****
  	 check that the edge is not a FALLTHRU edge.  */
        if ((s = b->succ) != NULL
  	  && s->succ_next == NULL
! 	  && s->dest == c)
  	tidy_fallthru_edge (s, b, c);
      }
  
--- 1562,1573 ----
  	 check that the edge is not a FALLTHRU edge.  */
        if ((s = b->succ) != NULL
  	  && s->succ_next == NULL
! 	  && s->dest == c
! 	  /* If the last insn is not a normal conditional jump
! 	     (or an unconditional jump), then we can not tidy the
! 	     fallthru edge because we can not delete the jump.  */
! 	  && GET_CODE (b->end) == JUMP_INSN
! 	  && condjump_p (b->end))
  	tidy_fallthru_edge (s, b, c);
      }
  
*************** delete_unreachable_blocks ()
*** 1581,1586 ****
--- 1586,1596 ----
  	     && (s->flags & EDGE_EH) == 0
  	     && (c = s->dest) != EXIT_BLOCK_PTR
  	     && c->pred->pred_next == NULL
+ 	     /* If the last insn is not a normal conditional jump
+ 		(or an unconditional jump), then we can not merge
+ 		the blocks because we can not delete the jump.  */
+ 	     && GET_CODE (b->end) == JUMP_INSN
+ 	     && condjump_p (b->end)
  	     && merge_blocks (s, b, c))
  	continue;
  




More information about the Gcc-patches mailing list