From: Jason Merrill Date: Sat, 9 Sep 2017 22:22:16 +0000 (-0400) Subject: Revert: * dwarf2out.c (gen_formal_parameter_die): Remove obsolete hunk. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=96fddae85c00659239e26165c20480dd01d74a60;p=gcc.git Revert: * dwarf2out.c (gen_formal_parameter_die): Remove obsolete hunk. Check ultimate_origin before setting reusing_die. From-SVN: r251941 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 01d42519cc1..b9b04565d28 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,9 +1,3 @@ -2017-09-09 Richard Biener - Jason Merrill - - * dwarf2out.c (gen_formal_parameter_die): Remove obsolete hunk. - Check ultimate_origin before setting reusing_die. - 2017-09-08 Jason Merrill PR c++/70029 - ICE with ref-qualifier and -flto diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index cc93db37e23..00d6d951ba3 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -21285,15 +21285,30 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, dw_die_ref context_die) { tree node_or_origin = node ? node : origin; + tree ultimate_origin; dw_die_ref parm_die = NULL; if (DECL_P (node_or_origin)) { parm_die = lookup_decl_die (node); - tree ultimate_origin = decl_ultimate_origin (node_or_origin); - if (node || ultimate_origin) - origin = ultimate_origin; + /* If the contexts differ, we may not be talking about the same + thing. + ??? When in LTO the DIE parent is the "abstract" copy and the + context_die is the specification "copy". But this whole block + should eventually be no longer needed. */ + if (parm_die && parm_die->die_parent != context_die && !in_lto_p) + { + if (!DECL_ABSTRACT_P (node)) + { + /* This can happen when creating an inlined instance, in + which case we need to create a new DIE that will get + annotated with DW_AT_abstract_origin. */ + parm_die = NULL; + } + else + gcc_unreachable (); + } if (parm_die && parm_die->die_parent == NULL) { @@ -21328,6 +21343,10 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, switch (TREE_CODE_CLASS (TREE_CODE (node_or_origin))) { case tcc_declaration: + ultimate_origin = decl_ultimate_origin (node_or_origin); + if (node || ultimate_origin) + origin = ultimate_origin; + if (reusing_die) goto add_location;