+2018-07-25 Richard Biener <rguenther@suse.de>
+
+ 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 <richard.sandiford@arm.com>
PR tree-optimization/86644
*/
|| (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
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;