Patchwork Fix DF mw_hardregs memory leaks (PR middle-end/56461)

login
register
mail settings
Submitter Jakub Jelinek
Date Feb. 27, 2013, 4:01 p.m.
Message ID <20130227160157.GL12913@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/223644/
State New
Headers show

Comments

Jakub Jelinek - Feb. 27, 2013, 4:01 p.m.
Hi!

We can leak mw_hardregs memory in some cases.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

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

	PR middle-end/56461
	* df-scan.c (df_insn_delete): Use df_scan_free_mws_vec before
	pool_free.
	(df_insn_rescan_debug_internal): Use df_scan_free_mws_vec before
	overwriting it.


	Jakub
Paolo Bonzini - Feb. 27, 2013, 4:05 p.m.
Il 27/02/2013 17:01, Jakub Jelinek ha scritto:
> Hi!
> 
> We can leak mw_hardregs memory in some cases.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?
> 
> 2013-02-27  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/56461
> 	* df-scan.c (df_insn_delete): Use df_scan_free_mws_vec before
> 	pool_free.
> 	(df_insn_rescan_debug_internal): Use df_scan_free_mws_vec before
> 	overwriting it.

Ok.

Paolo
Kenneth Zadeck - Feb. 27, 2013, 4:06 p.m.
looks ok, not my call as to the as to the appropriate for stage 4.
On 02/27/2013 11:01 AM, Jakub Jelinek wrote:
> Hi!
>
> We can leak mw_hardregs memory in some cases.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?
>
> 2013-02-27  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR middle-end/56461
> 	* df-scan.c (df_insn_delete): Use df_scan_free_mws_vec before
> 	pool_free.
> 	(df_insn_rescan_debug_internal): Use df_scan_free_mws_vec before
> 	overwriting it.
>
> --- gcc/df-scan.c.jj	2013-01-11 09:02:45.000000000 +0100
> +++ gcc/df-scan.c	2013-02-27 10:01:13.052826959 +0100
> @@ -1153,6 +1153,7 @@ df_insn_delete (basic_block bb, unsigned
>   	  df_ref_chain_delete (insn_info->defs);
>   	  df_ref_chain_delete (insn_info->uses);
>   	  df_ref_chain_delete (insn_info->eq_uses);
> +	  df_scan_free_mws_vec (insn_info->mw_hardregs);
>   	}
>         pool_free (problem_data->insn_pool, insn_info);
>         DF_INSN_UID_SET (uid, NULL);
> @@ -1332,6 +1333,7 @@ df_insn_rescan_debug_internal (rtx insn)
>     df_ref_chain_delete (insn_info->defs);
>     df_ref_chain_delete (insn_info->uses);
>     df_ref_chain_delete (insn_info->eq_uses);
> +  df_scan_free_mws_vec (insn_info->mw_hardregs);
>   
>     insn_info->defs = df_null_ref_rec;
>     insn_info->uses = df_null_ref_rec;
>
> 	Jakub

Patch

--- gcc/df-scan.c.jj	2013-01-11 09:02:45.000000000 +0100
+++ gcc/df-scan.c	2013-02-27 10:01:13.052826959 +0100
@@ -1153,6 +1153,7 @@  df_insn_delete (basic_block bb, unsigned
 	  df_ref_chain_delete (insn_info->defs);
 	  df_ref_chain_delete (insn_info->uses);
 	  df_ref_chain_delete (insn_info->eq_uses);
+	  df_scan_free_mws_vec (insn_info->mw_hardregs);
 	}
       pool_free (problem_data->insn_pool, insn_info);
       DF_INSN_UID_SET (uid, NULL);
@@ -1332,6 +1333,7 @@  df_insn_rescan_debug_internal (rtx insn)
   df_ref_chain_delete (insn_info->defs);
   df_ref_chain_delete (insn_info->uses);
   df_ref_chain_delete (insn_info->eq_uses);
+  df_scan_free_mws_vec (insn_info->mw_hardregs);
 
   insn_info->defs = df_null_ref_rec;
   insn_info->uses = df_null_ref_rec;