[PATCH] Fix memory leak in tree_estimate_loop_size (PR middle-end/56461)

Richard Biener rguenther@suse.de
Mon Mar 4 10:00:00 GMT 2013


On Fri, 1 Mar 2013, Jakub Jelinek wrote:

> Hi!
> 
> path vector has been only released when return false; later in the function,
> but not in this case.  Bootstrapped/regtested on x86_64-linux and
> i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2013-03-01  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/56461
> 	* tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Release path
> 	vector even when returning true.  Fix up function comment formatting.
> 
> --- gcc/tree-ssa-loop-ivcanon.c.jj	2013-01-11 09:02:48.000000000 +0100
> +++ gcc/tree-ssa-loop-ivcanon.c	2013-03-01 17:16:51.955088637 +0100
> @@ -207,7 +207,7 @@ constant_after_peeling (tree op, gimple
>     EDGE_TO_CANCEL (if non-NULL) is an non-exit edge eliminated in the last iteration
>     of loop.
>     Return results in SIZE, estimate benefits for complete unrolling exiting by EXIT. 
> -   Stop estimating after UPPER_BOUND is met. Return true in this case */
> +   Stop estimating after UPPER_BOUND is met.  Return true in this case.  */
>  
>  static bool
>  tree_estimate_loop_size (struct loop *loop, edge exit, edge edge_to_cancel, struct loop_size *size,
> @@ -321,6 +321,7 @@ tree_estimate_loop_size (struct loop *lo
>  	      - size->last_iteration_eliminated_by_peeling) > upper_bound)
>  	    {
>                free (body);
> +	      path.release ();
>  	      return true;
>  	    }
>  	}
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend



More information about the Gcc-patches mailing list