This cleans up allocation/deallocation of reference_vars_to_consider, specifically always releasing the vector allocated in ipa_init and also making sure to release it before re-allocating it in ipa_reference_write_optimization_summary.
Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? Thanks, Richard. 2021-02-10 Richard Biener <rguent...@suse.de> PR ipa/97346 * ipa-reference.c (propagate): Always free reference_vars_to_consider. (ipa_reference_write_optimization_summary): Free reference_vars_to_consider before re-allocating it. (ipa_reference_write_optimization_summary): Use vec_free and NULL reference_vars_to_consider. --- gcc/ipa-reference.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 2ea2a6d5327..a6b79fb9381 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -966,8 +966,7 @@ propagate (void) ipa_ref_var_info_summaries = NULL; } - if (dump_file) - vec_free (reference_vars_to_consider); + vec_free (reference_vars_to_consider); reference_vars_to_consider = NULL; return remove_p ? TODO_remove_functions : 0; } @@ -1059,6 +1058,7 @@ ipa_reference_write_optimization_summary (void) auto_bitmap ltrans_statics; int i; + vec_free (reference_vars_to_consider); vec_alloc (reference_vars_to_consider, ipa_reference_vars_uids); reference_vars_to_consider->safe_grow (ipa_reference_vars_uids, true); @@ -1117,7 +1117,8 @@ ipa_reference_write_optimization_summary (void) } } lto_destroy_simple_output_block (ob); - delete reference_vars_to_consider; + vec_free (reference_vars_to_consider); + reference_vars_to_consider = NULL; } /* Deserialize the ipa info for lto. */ -- 2.26.2