https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96059
--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> --- Which means that the following (untested) patch might be the correct fix: diff --git a/gcc/ipa.cc b/gcc/ipa.cc index 5c15b60a603..c2d94163dc2 100644 --- a/gcc/ipa.cc +++ b/gcc/ipa.cc @@ -199,6 +199,11 @@ walk_polymorphic_call_targets (hash_set<void *> *reachable_call_targets, n->indirect_call_target = true; symtab_node *body = n->function_symbol (); + /* We have already decided that an offlie copy which could be a + target of a virtual call is not necessary. */ + if (n->inlined_to) + continue; + /* Prior inlining, keep alive bodies of possible targets for devirtualization. */ if (n->definition