From abf0474f8a8a466befb8fa4b00b44a51bab22143 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 17 Oct 2019 06:16:50 +0000 Subject: [PATCH] re PR debug/91887 (-fdebug-types-section ICE building chromium) 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: r277090 --- gcc/ChangeLog | 6 ++++++ gcc/dwarf2out.c | 23 ++++++++++----------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C | 12 +++++++++++ 4 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85b88cf6ecb..afe0d29f6e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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-16 Jakub Jelinek * tree-ssa-strlen.c (maybe_invalidate): Use diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index bf69ce497f2..9f1d921ddad 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -22304,19 +22304,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 0785e413e91..b574d995ebd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-17 Richard Biener + + PR debug/91887 + * g++.dg/debug/dwarf2/pr91887.C: New testcase. + 2019-10-16 Martin Sebor PR tree-optimization/83821 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 00000000000..6cd99cc9bb8 --- /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)); } -- 2.30.2