jump failure w/ varray

Richard Henderson rth@cygnus.com
Sun Jul 5 01:10:00 GMT 1998


I get a segv in building stage2 on alpha building collect.c.

The problem is that while allocate_reg_info sizes the array with
some slop, we don't properly initialize any of the elements in
the slop zone, so when we go to access them later (as in jump.c
circa line 1070), we lose.


r~


Index: regclass.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/regclass.c,v
retrieving revision 1.25
diff -c -p -d -r1.25 regclass.c
*** regclass.c	1998/07/02 13:49:34	1.25
--- regclass.c	1998/07/05 08:05:20
*************** allocate_reg_info (num_regs, new_p, renu
*** 1866,1874 ****
  	  size_t max_index = reg_data->max_index;
  
  	  reg_next = reg_data->next;
! 	  if (min_index <= num_regs)
  	    {
! 	      size_t max = (max_index > num_regs) ? num_regs : max_index;
  	      if (!reg_data->used_p)	/* page just allocated with calloc */
  		reg_data->used_p = 1;	/* no need to zero */
  	      else
--- 1866,1876 ----
  	  size_t max_index = reg_data->max_index;
  
  	  reg_next = reg_data->next;
! 	  if (min_index <= regno_allocated)
  	    {
! 	      size_t max = max_index;
! 	      if (max > regno_allocated)
! 		max = regno_allocated;
  	      if (!reg_data->used_p)	/* page just allocated with calloc */
  		reg_data->used_p = 1;	/* no need to zero */
  	      else



More information about the Gcc-patches mailing list