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]

reg_n_info lossage


The new valarray implementation of allocate_reg_info does not
properly care for the resize case.  Instead of simply zeroing
the new entries, it zaps all of them.

This shows up, for instance, in jump.  On Alpha, given 

                if (ca >= 'A' && ca <= 'Z')
                        ca += 'a' - 'A';
                if (cb >= 'A' && cb <= 'Z')
                        cb += 'a' - 'A';

I'll only get one cmove generated, this because when it came
time to do the second transform, the reg info had been killed.


r~



	* regclass.c (allocate_reg_info): Respect MIN when clearing data.

Index: regclass.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/regclass.c,v
retrieving revision 1.27
diff -u -p -r1.27 regclass.c
--- regclass.c	1998/07/13 03:34:10	1.27
+++ regclass.c	1998/08/10 07:24:42
@@ -1866,18 +1866,21 @@ allocate_reg_info (num_regs, new_p, renu
 	  size_t max_index = reg_data->max_index;
 
 	  reg_next = reg_data->next;
-	  if (min_index <= regno_allocated)
+	  if (min_index <= regno_allocated && min < max_index)
 	    {
 	      size_t max = max_index;
+	      size_t local_min = min - min_index;
 	      if (max > regno_allocated)
 		max = regno_allocated;
+	      if (min < min_index)
+		local_min = 0;
 	      if (!reg_data->used_p)	/* page just allocated with calloc */
 		reg_data->used_p = 1;	/* no need to zero */
 	      else
-		bzero ((char *) &reg_data->data,
-		       sizeof (reg_info) * (max - min_index + 1));
+		bzero ((char *) &reg_data->data[local_min],
+		       sizeof (reg_info) * (max - min_index - local_min + 1));
 
-	      for (i = min_index; i <= max; i++)
+	      for (i = min_index+local_min; i <= max; i++)
 		{
 		  VARRAY_REG (reg_n_info, i) = &reg_data->data[i-min_index];
 		  REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;


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