[PATCH] Fix sel-sched memory leak (PR middle-end/56461)

Andrey Belevantsev abel@ispras.ru
Tue Mar 5 05:55:00 GMT 2013


Hi Jakub,

On 2013-03-05 01:20, Jakub Jelinek wrote:
> Hi!
> 
> alloc_succs_info creates vectors up to and including
> succs_info_pool.max_top, so without the following fix we leak the
> last set of 3 vectors.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, 
> ok for
> trunk?

This is fine, thanks a lot.  I can take care of backporting this to the 
older branches with the other sel-sched patches.

Andrey

> 
> 2013-03-04  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/56461
> 	* sel-sched-ir.c (free_sched_pools): Release
> 	succs_info_pool.stack[succs_info_pool.max_top] vectors too
> 	if succs_info_pool.max_top isn't -1.
> 
> --- gcc/sel-sched-ir.c.jj	2013-02-27 14:59:51.000000000 +0100
> +++ gcc/sel-sched-ir.c	2013-03-04 17:47:34.705686637 +0100
> @@ -5020,7 +5020,7 @@ free_sched_pools (void)
> 
>    free_alloc_pool (sched_lists_pool);
>    gcc_assert (succs_info_pool.top == -1);
> -  for (i = 0; i < succs_info_pool.max_top; i++)
> +  for (i = 0; i <= succs_info_pool.max_top; i++)
>      {
>        succs_info_pool.stack[i].succs_ok.release ();
>        succs_info_pool.stack[i].succs_other.release ();
> 
> 	Jakub



More information about the Gcc-patches mailing list