[patch] fix memory corruption bug in tm_region_init

Richard Henderson rth@redhat.com
Mon Mar 5 17:16:00 GMT 2012


On 03/05/2012 08:54 AM, Aldy Hernandez wrote:
>    region_worklist =
>      (struct tm_region **) xcalloc (sizeof (struct tm_region *),
> -				  n_basic_blocks + NUM_FIXED_BLOCKS + 2);
> +				  last_basic_block + NUM_FIXED_BLOCKS);

This is ok.

I was confused for a moment by the "worklist" variable name, which
suggests a queue.  I'd also suggest that you change to use a vec,
rather than callocing yourself, and would have caught the memory
error earlier.


r~



More information about the Gcc-patches mailing list