https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95315
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Arseny Solokha from comment #4) > Shouldn't there be > > if (!node_removal_hook_holder) > node_removal_hook_holder > = symtab->add_cgraph_removal_hook (… > > instead? Of course, good catch. For the particular testcase, only the non-removal_hook related part of the patch is sufficient, and I didn't try to come up with a testcase where a function is originally needed, but e.g. early inlining makes it go away. Will try to construct that and see if the removal hook fix will fix that.