https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97346
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
So like the following? Note the leak is the allcoation from ipa_init
being not released when we do the vec_alloc in
ipa_reference_write_optimization_summary (maybe this function wants to
use its own private vector?!)
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 2ea2a6d5327..328fa8f732c 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,7 +1058,7 @@ ipa_reference_write_optimization_summary (void)
auto_bitmap ltrans_statics;
int i;
- vec_alloc (reference_vars_to_consider, ipa_reference_vars_uids);
+ vec_truncate (reference_vars_to_consider, 0);
reference_vars_to_consider->safe_grow (ipa_reference_vars_uids, true);
/* See what variables we are interested in. */
@@ -1117,7 +1116,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. */