Patchwork Fix memory leak in ipa-reference (PR middle-end/56461)

login
register
mail settings
Submitter Jakub Jelinek
Date Feb. 27, 2013, 3:58 p.m.
Message ID <20130227155818.GJ12913@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/223643/
State New
Headers show

Comments

Jakub Jelinek - Feb. 27, 2013, 3:58 p.m.
Hi!

Apparently even node->alias nodes can have reference vars info created,
so we need to free it too.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2013-02-27  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/56461
	* ipa-reference.c (propagate): Free node_info even for alias nodes.


	Jakub
Richard Guenther - Feb. 27, 2013, 7:50 p.m.
On 2/27/13 4:58 PM, Jakub Jelinek wrote:
> Hi!
> 
> Apparently even node->alias nodes can have reference vars info created,
> so we need to free it too.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2013-02-27  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/56461
> 	* ipa-reference.c (propagate): Free node_info even for alias nodes.
> 
> --- gcc/ipa-reference.c.jj	2013-01-11 09:02:37.000000000 +0100
> +++ gcc/ipa-reference.c	2013-02-27 09:17:00.692004693 +0100
> @@ -834,12 +834,10 @@ propagate (void)
>        ipa_reference_global_vars_info_t node_g;
>        ipa_reference_optimization_summary_t opt;
>  
> -      if (node->alias)
> -        continue;
> -
>        node_info = get_reference_vars_info (node);
> -      if (cgraph_function_body_availability (node) > AVAIL_OVERWRITABLE
> -	  || (flags_from_decl_or_type (node->symbol.decl) & ECF_LEAF))
> +      if (!node->alias
> +	  && (cgraph_function_body_availability (node) > AVAIL_OVERWRITABLE
> +	      || (flags_from_decl_or_type (node->symbol.decl) & ECF_LEAF)))
>  	{
>  	  node_g = &node_info->global;
>  
> 
> 	Jakub
>

Patch

--- gcc/ipa-reference.c.jj	2013-01-11 09:02:37.000000000 +0100
+++ gcc/ipa-reference.c	2013-02-27 09:17:00.692004693 +0100
@@ -834,12 +834,10 @@  propagate (void)
       ipa_reference_global_vars_info_t node_g;
       ipa_reference_optimization_summary_t opt;
 
-      if (node->alias)
-        continue;
-
       node_info = get_reference_vars_info (node);
-      if (cgraph_function_body_availability (node) > AVAIL_OVERWRITABLE
-	  || (flags_from_decl_or_type (node->symbol.decl) & ECF_LEAF))
+      if (!node->alias
+	  && (cgraph_function_body_availability (node) > AVAIL_OVERWRITABLE
+	      || (flags_from_decl_or_type (node->symbol.decl) & ECF_LEAF)))
 	{
 	  node_g = &node_info->global;