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/05/12 11:16, Richard Henderson wrote:
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~

I thought there'd be a lot less overhead by callocing the value myself. Is the overhead negligible?


I can certainly make it a VEC in a follow up patch if you want, though I'll commit this now so I can at get Rainer and Torvald happy while I do so.

Aldy


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