https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81940
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Ok, so we have no early debug but enable late debug. I suppose at some point we want to have -g vs. -g0 set per function. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 251275) +++ gcc/dwarf2out.c (working copy) @@ -21609,7 +21578,10 @@ dwarf2out_abstract_function (tree decl) return; old_die = lookup_decl_die (decl); - /* With early debug we always have an old DIE. */ + /* With early debug we always have an old DIE unless we are in LTO + and the user did not compile but only link with debug. */ + if (in_lto_p && ! old_die) + return; gcc_assert (old_die != NULL); if (get_AT (old_die, DW_AT_inline) || get_AT (old_die, DW_AT_abstract_origin)) mixing -g0 at compile-time with -g at link time might uncover more surprises.