This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: sched/flow problem with memory corruption due to mark_set_resources


On Sun, Aug 29, 1999 at 11:11:51PM -0700, Jim Wilson wrote:
> I got a segfault while trying to build a mips cross compiler from gcc sources
> I checked out on Saturday.  I tracked the problem down to your Aug 24 flow
> and sched changes.

Do you have this tree handy?  If so, would you try out the following?

It seems we didn't _need_ to use the resource code, and in fact it's
a bit silly to do so here.


r~


	* flow.c (new_insn_dead_notes): Use sets_reg_or_subreg not
	mark_set_resources.

Index: flow.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/flow.c,v
retrieving revision 1.142
diff -c -p -d -r1.142 flow.c
*** flow.c	1999/08/28 23:29:55	1.142
--- flow.c	1999/08/30 20:52:23
*************** Boston, MA 02111-1307, USA.  */
*** 132,138 ****
  #include "toplev.h"
  #include "recog.h"
  #include "insn-flags.h"
- #include "resource.h"
  
  #include "obstack.h"
  #define obstack_chunk_alloc xmalloc
--- 132,137 ----
*************** new_insn_dead_notes (pat, insn, first, l
*** 5371,5376 ****
--- 5370,5376 ----
  	  if (tem == orig_last_insn)
  	    break;
  	}
+ 
        /* So it's a new register, presumably only used within this
  	 group of insns. Find the last insn in the set of new insns
  	 that DEST is referenced in, and add a dead note to it. */
*************** new_insn_dead_notes (pat, insn, first, l
*** 5393,5409 ****
  	    }
  	  else
  	    {
- 	      struct resources res;
  	      rtx curr;
  
! 	      CLEAR_RESOURCE (&res);
! 	      for (curr = orig_first_insn;
! 		   curr != NULL_RTX;
! 		   curr = NEXT_INSN (curr))
  		{
! 		  if (GET_RTX_CLASS (GET_CODE (curr)) == 'i')
! 		    mark_set_resources (PATTERN (curr), &res, 0, 0);
! 		  if (TEST_HARD_REG_BIT (res.regs, REGNO (dest)))
  		    break;
  		  if (curr == orig_last_insn)
  		    break;
--- 5393,5405 ----
  	    }
  	  else
  	    {
  	      rtx curr;
+ 	      int got_set = 0;
  
! 	      for (curr = orig_first_insn; curr; curr = NEXT_INSN (curr))
  		{
! 		  got_set = sets_reg_or_subreg (curr, dest);
! 		  if (got_set)
  		    break;
  		  if (curr == orig_last_insn)
  		    break;
*************** new_insn_dead_notes (pat, insn, first, l
*** 5411,5417 ****
  
  	      /* In case reg was not used later, it is dead store.
  	         add REG_UNUSED note.  */
! 	      if (! TEST_HARD_REG_BIT (res.regs, REGNO (dest)))
  	        {
  	          rtx note = rtx_alloc (EXPR_LIST);
  	          PUT_REG_NOTE_KIND (note, REG_UNUSED);
--- 5407,5413 ----
  
  	      /* In case reg was not used later, it is dead store.
  	         add REG_UNUSED note.  */
! 	      if (! got_set)
  	        {
  	          rtx note = rtx_alloc (EXPR_LIST);
  	          PUT_REG_NOTE_KIND (note, REG_UNUSED);
*************** new_insn_dead_notes (pat, insn, first, l
*** 5422,5430 ****
--- 5418,5428 ----
  	        }
  	    }
  	}
+ 
        if (insn != first)
  	{
  	  rtx set = single_set (insn);
+ 
  	  /* If this is a set, scan backwards for a previous
  	     reference, and attach a REG_DEAD note to it. But we don't
  	     want to do it if the insn is both using and setting the


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