From: Richard Biener Date: Wed, 23 Oct 2019 10:32:06 +0000 (+0000) Subject: backport: re PR debug/91887 (-fdebug-types-section ICE building chromium) X-Git-Tag: releases/gcc-9.3.0~503 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ce10ed63cd6c293e5f00d976061eec5ff7a5724;p=thirdparty%2Fgcc.git backport: re PR debug/91887 (-fdebug-types-section ICE building chromium) 2019-10-23 Richard Biener Backport from mainline 2019-10-17 Richard Biener PR debug/91887 * dwarf2out.c (gen_formal_parameter_die): Also try to match context_die against a DW_TAG_GNU_formal_parameter_pack parent. * g++.dg/debug/dwarf2/pr91887.C: New testcase. From-SVN: r277312 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d213669fdb48..1ab4bb919538 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-10-23 Richard Biener + + Backport from mainline + 2019-10-17 Richard Biener + + PR debug/91887 + * dwarf2out.c (gen_formal_parameter_die): Also try to match + context_die against a DW_TAG_GNU_formal_parameter_pack parent. + 2019-10-21 Jakub Jelinek Backported from mainline diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 60a986e1c301..55a73e12cc25 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -22284,19 +22284,18 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, /* 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) + context_die is the specification "copy". */ + if (parm_die + && parm_die->die_parent != context_die + && (parm_die->die_parent->die_tag != DW_TAG_GNU_formal_parameter_pack + || parm_die->die_parent->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 (); + gcc_assert (!DECL_ABSTRACT_P (node)); + /* This can happen when creating a concrete instance, in + which case we need to create a new DIE that will get + annotated with DW_AT_abstract_origin. */ + parm_die = NULL; } if (parm_die && parm_die->die_parent == NULL) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 54707bd1e067..7c7e0bf83753 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-10-23 Richard Biener + + Backport from mainline + 2019-10-17 Richard Biener + + PR debug/91887 + * g++.dg/debug/dwarf2/pr91887.C: New testcase. + 2019-10-21 Jakub Jelinek Backported from mainline diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C new file mode 100644 index 000000000000..6cd99cc9bb86 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-require-effective-target c++11 } +// { dg-options "-g -fdebug-types-section" } +class A { +public: + A(); + template A(U); +}; +template struct B { typedef A type; }; +template +int Bind(R(Args...), typename B::type...) { return 0; } +void KeepBufferRefs(A, A) { A a, b(Bind(KeepBufferRefs, a, b)); }