王亮 <netcas...@gmail.com> writes:

> Hi,
>
> Current implementation of ggc_alloc_rtvec_sized is
>
> #define ggc_alloc_rtvec_sized(NELT)                                     \
>     (ggc_alloc_zone_vec_rtvec_def (sizeof (rtx),                        \
>                                    sizeof (struct rtvec_def) + ((NELT) - 1), \
>                                    &rtl_zone))
>
> The size it allocates is
>
>   (sizeof (struct rtvec_def) + ((NELT) - 1)) * sizeof (rtx)
>      // (1)
>
> Originally, the allocated size is
>
>   sizeof (struct rtvec_def) + ((NELT) - 1) * sizeof (rtx)
>     // (2)
>
> So current implementation allocates more spaces than before.
>
> I replace the second parameter of ggc_alloc_zone_vec_rtvec_def with
>
>   (sizeof (struct rtvec_def) + sizeof (rtx) - 1) / sizeof (rtx) +
> ((NELT) - 1)   // (3)

I think it was meant to be this:

#define ggc_alloc_rtvec_sized(NELT)                                     \
  ggc_alloc_zone_rtvec_def (sizeof (struct rtvec_def)                   \
                            + ((NELT) - 1) * sizeof (rtx),              \
                            &rtl_zone)

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Reply via email to