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]
Other format: [Raw text]

Re: [patch] fix memory corruption bug in tm_region_init


On 03/06/12 07:55, Aldy Hernandez wrote:
> +  bb_regions = VEC_alloc (tm_region_p, heap, last_basic_block);
> +  VEC_reserve (tm_region_p, heap, bb_regions, last_basic_block);
> +  for (i = 0; i < last_basic_block; ++i)
> +    VEC_quick_insert (tm_region_p, bb_regions, i, NULL);

The reserve is redundant, since you already did that in the alloc.
You're looking for VEC_safe_grow_cleared here instead of that loop.

Otherwise ok.


r~


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