https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86654
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- So it doesn't seem to be the same issue as the last one but with SCC size != 1 since the following doesn't make it ICE for me: Index: lto/lto.c =================================================================== --- lto/lto.c (revision 262940) +++ lto/lto.c (working copy) @@ -1670,6 +1670,24 @@ unify_scc (struct data_in *data_in, unsi { lto_maybe_register_decl (data_in, map[2*i], (uintptr_t)map2[2*i]); + tree prevail = map[2*i]; + if (dref_queue.length () != 0 + && ((DECL_P (prevail) + && TREE_CODE (prevail) != FIELD_DECL + && TREE_CODE (prevail) != DEBUG_EXPR_DECL + && TREE_CODE (prevail) != TYPE_DECL) + || TREE_CODE (prevail) == BLOCK)) + { + tree nonprevail = streamer_tree_cache_get_tree (cache, (uintptr_t)map2[2*i]); + const char *sym; + unsigned HOST_WIDE_INT off; + if (!debug_hooks->die_ref_for_decl (prevail, &sym, &off)) + { + for (unsigned k = 0; k < dref_queue.length (); ++k) + if (dref_queue[k].decl == nonprevail) + gcc_unreachable (); + } + } streamer_tree_cache_replace_tree (cache, map[2*i], (uintptr_t)map2[2*i]); } For the testcase we are missing a DIE for the context of operator().constprop which non-type-context is $2 = <function_decl 0x7ffff6696700 FilterMatches> Ah, we create operator().constprop late where we _do_ have the DIE for FilterMatches available but we do not look at DECL_ABSTRACT_ORIGIN when setting a context die. Instead we start with comp_unit_die () and run into static void dwarf2out_decl (tree decl) { dw_die_ref context_die = comp_unit_die (); switch (TREE_CODE (decl)) { ... case FUNCTION_DECL: /* If we're a nested function, initially use a parent of NULL; if we're a plain function, this will be fixed up in decls_for_scope. If we're a method, it will be ignored, since we already have a DIE. */ if (decl_function_context (decl) /* But if we're in terse mode, we don't care about scope. */ && debug_info_level > DINFO_LEVEL_TERSE) context_die = NULL; break; my gut feeling would be to guard the above with early_dwarf ... The other option would be to assign a more appropriate DECL_CONTEXT to clones rather than simply copying the DECL_CONTEXT of the origin. So the following otherwise untested patch fixes the testcase: Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 262940) +++ dwarf2out.c (working copy) @@ -26703,7 +26703,8 @@ dwarf2out_decl (tree decl) /* If we're a nested function, initially use a parent of NULL; if we're a plain function, this will be fixed up in decls_for_scope. If we're a method, it will be ignored, since we already have a DIE. */ - if (decl_function_context (decl) + if (early_dwarf + && decl_function_context (decl) /* But if we're in terse mode, we don't care about scope. */ && debug_info_level > DINFO_LEVEL_TERSE) context_die = NULL;