This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] growing regno_reg_rtx
- From: "Bonzini" <bonzini at gnu dot org>
- To: <gcc-patches at gcc dot gnu dot org>,<fnf at public dot ninemoons dot com>
- Date: Sat, 8 Feb 2003 09:53:23 +0100
- Subject: Re: [RFC] growing regno_reg_rtx
> It appears to me that the zeroing of the newly allocated part of
> regno_reg_rtx starts at the wrong place. I think the end of the previous
> storage is found at "old_size * sizeof (rtx)" from the reallocated space,
> rather than "old_size", since sizeof(rtx) != 1.
>
> new1 = (rtx *) ggc_realloc (f->emit->x_regno_reg_rtx,
> old_size * 2 * sizeof (rtx));
>- memset (new1 + old_size, 0, old_size * sizeof (rtx));
>+ memset (new1 + (old_size * sizeof (rtx)), 0, old_size * sizeof
(rtx));
The code was right. Since new1 is an rtx*, summing old_size automagically
multiplies it by sizeof(rtx). new1 + old_size is the same as
&new1[old_size], which clearly does the multiplication.
Paolo