https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97346
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #7) > I tested yesterday this one (which makes the lifetime bit more explicit > - during propagation it is for dumps only). Sorry for not posting it > earlier. I just wanted to double check tha tleak is gone. > > diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c > index 2ea2a6d5327..84c018ff57c 100644 > --- a/gcc/ipa-reference.c > +++ b/gcc/ipa-reference.c > @@ -458,8 +458,8 @@ ipa_init (void) > > ipa_init_p = true; > > - vec_alloc (reference_vars_to_consider, 10); > - > + if (dump_file) > + vec_alloc (reference_vars_to_consider, 10); > > if (ipa_ref_opt_sum_summaries != NULL) > { > @@ -967,8 +967,12 @@ propagate (void) > } > > if (dump_file) > - vec_free (reference_vars_to_consider); > - reference_vars_to_consider = NULL; > + { > + vec_free (reference_vars_to_consider); > + reference_vars_to_consider = NULL; > + } > + else > + gcc_checking_assert (!reference_vars_to_consider); > return remove_p ? TODO_remove_functions : 0; > } > > @@ -1059,6 +1063,7 @@ ipa_reference_write_optimization_summary (void) > auto_bitmap ltrans_statics; > int i; > > + gcc_checking_assert (!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 +1122,7 @@ ipa_reference_write_optimization_summary (void) > } > } > lto_destroy_simple_output_block (ob); > - delete reference_vars_to_consider; > + vec_free (reference_vars_to_consider); maybe set reference_vars_to_consider to NULL here for consistency, otherwise also looks good to me! > } > > /* Deserialize the ipa info for lto. */