https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118125
--- Comment #11 from Martin Jambor <jamborm at gcc dot gnu.org> --- The issue can also be reproduced with applying: diff --git a/gcc/ipa-fnsummary.cc b/gcc/ipa-fnsummary.cc index 33f19365ec3..4c062fe8a0e 100644 --- a/gcc/ipa-fnsummary.cc +++ b/gcc/ipa-fnsummary.cc @@ -255,6 +255,9 @@ redirect_to_unreachable (struct cgraph_edge *e) struct cgraph_node *target = cgraph_node::get_create (builtin_decl_unreachable ()); + gcc_checking_assert (lookup_attribute ("cold", + DECL_ATTRIBUTES (target->decl))); + if (e->speculative) e = cgraph_edge::resolve_speculation (e, target->decl); else if (!e->callee) and building our lto testcases testsuite/gcc.dg/lto/ipacp_?.c or testsuite/gcc.dg/lto/pr101868_?.c