From 9c13689e64e4c13428c0745c02ee587be141fa2a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 25 Jul 2018 12:10:13 +0000 Subject: [PATCH] re PR lto/86654 (ICE in gen_member_die, at dwarf2out.c:24933) 2018-07-25 Richard Biener PR debug/86654 * dwarf2out.c (dwarf2out_decl): Do not handle nested functions special wrt context_die late. (gen_subprogram_die): Re-use DIEs in local scope. From-SVN: r262965 --- gcc/ChangeLog | 7 +++++++ gcc/dwarf2out.c | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 09c2f5f9198..202b43b4fc3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-07-25 Richard Biener + + PR debug/86654 + * dwarf2out.c (dwarf2out_decl): Do not handle nested functions + special wrt context_die late. + (gen_subprogram_die): Re-use DIEs in local scope. + 2018-07-25 Richard Sandiford PR tree-optimization/86644 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 8377cbc5dd1..208f2e97e7c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -22766,6 +22766,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) */ || (old_die->die_parent && old_die->die_parent->die_tag == DW_TAG_module) + || local_scope_p (old_die->die_parent) || context_die == NULL) && (DECL_ARTIFICIAL (decl) || (get_AT_file (old_die, DW_AT_decl_file) == file_index @@ -26702,8 +26703,11 @@ dwarf2out_decl (tree 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) + we're a method, it will be ignored, since we already have a DIE. + Avoid doing this late though since clones of class methods may + otherwise end up in limbo and create type DIEs late. */ + 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; -- 2.30.2