https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97346
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- At least diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 4a6c011c525..6df4be09471 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -1114,7 +1113,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. */ is maybe obvious. Then there's diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 4a6c011c525..f0555929340 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -1056,6 +1056,7 @@ ipa_reference_write_optimization_summary (void) auto_bitmap ltrans_statics; int i; + gcc_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); that will likely trip because of the ipa_init allocation. And diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 4a6c011c525..93b2b677a76 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -964,8 +964,10 @@ 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; + } return remove_p ? TODO_remove_functions : 0; } anyway, it all looks like a mess ;)