loop bugfix

Jeffrey A Law law@cygnus.com
Fri Jun 25 04:37:00 GMT 1999


This fixes compile/990625-1.c (a new test for an x86 glibc problem).

In a nutshell we have a loop with a jump table.  We tried to peek at
JUMP_LABEL (ADDR_DIFF) and got back NULL_RTX.  We then tried to look at
the INSN_LUID of the NULL_RTX and blew up.


	* loop.c (verify_dominator): Properly handle ADDR_VEC and
	ADDR_DIFF_VEC insns that appear inside loops.

Index: loop.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/loop.c,v
retrieving revision 1.156.4.6
diff -c -3 -p -r1.156.4.6 loop.c
*** loop.c	1999/06/10 00:24:42	1.156.4.6
--- loop.c	1999/06/25 11:31:59
*************** verify_dominator (loop_number)
*** 2557,2570 ****
  	  && GET_CODE (PATTERN (insn)) != RETURN)
  	{
  	  rtx label = JUMP_LABEL (insn);
! 	  int label_luid = INSN_LUID (label);
  
! 	  if (! condjump_p (insn)
! 	      && ! condjump_in_parallel_p (insn))
  	    {
  	      loop_number_cont_dominator[loop_number] = NULL_RTX;
  	      return;
  	    }
  	  if (label_luid < INSN_LUID (loop_number_loop_cont[loop_number])
  	      && (label_luid
  		  > INSN_LUID (loop_number_cont_dominator[loop_number])))
--- 2557,2577 ----
  	  && GET_CODE (PATTERN (insn)) != RETURN)
  	{
  	  rtx label = JUMP_LABEL (insn);
! 	  int label_luid;
  
! 	  /* If it is not a jump we can easily understand or for
! 	     which we do not have jump target information in the JUMP_LABEL
! 	     field (consider ADDR_VEC and ADDR_DIFF_VEC insns), then clear
! 	     LOOP_NUMBER_CONT_DOMINATOR.  */
! 	  if ((! condjump_p (insn)
! 	       && ! condjump_in_parallel_p (insn))
! 	      || label == NULL_RTX)
  	    {
  	      loop_number_cont_dominator[loop_number] = NULL_RTX;
  	      return;
  	    }
+ 
+ 	  label_luid = INSN_LUID (label);
  	  if (label_luid < INSN_LUID (loop_number_loop_cont[loop_number])
  	      && (label_luid
  		  > INSN_LUID (loop_number_cont_dominator[loop_number])))




More information about the Gcc-patches mailing list