From: Ed Catmur <e...@catmur.uk> Tested x86_64-pc-linux-gnu, applying to trunk.
-- 8< -- Per https://wiki.dwarfstd.org/C++0x_Variadic_templates.md DW_TAG_GNU_formal_parameter_pack should have a DW_AT_name: 17$: DW_TAG_formal_parameter_pack DW_AT_name("args") 18$: DW_TAG_formal_parameter ! no DW_AT_name attribute DW_AT_type(reference to 13$) (...) PR c++/70536 gcc/ChangeLog: * dwarf2out.cc (gen_formal_parameter_pack_die): Add name attr. gcc/testsuite/ChangeLog: * g++.dg/debug/dwarf2/template-func-params-7.C: Check for pack names. Co-authored-by: Jason Merrill <ja...@redhat.com> --- gcc/dwarf2out.cc | 2 +- gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 43884f206c0..ed7d9402200 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -23195,7 +23195,7 @@ gen_formal_parameter_pack_die (tree parm_pack, && subr_die); parm_pack_die = new_die (DW_TAG_GNU_formal_parameter_pack, subr_die, parm_pack); - add_src_coords_attributes (parm_pack_die, parm_pack); + add_name_and_src_coords_attributes (parm_pack_die, parm_pack); for (arg = pack_arg; arg; arg = DECL_CHAIN (arg)) { diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C b/gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C index 22b0e4f984d..4e95c238bcd 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C @@ -23,6 +23,9 @@ // These 3 function template instantiations has a total of 3 template // parameters named T. // { dg-final { scan-assembler-times "\.ascii \"T.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } } +// And the packs also have names. +// { dg-final { scan-assembler-times "\.ascii \"PTs.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } } +// { dg-final { scan-assembler-times "\.ascii \"args.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } } void @@ -35,11 +38,11 @@ printf(const char* s) */ } -template<typename T, typename... PackTypes> +template<typename T, typename... PTs> void printf(const char* s, T value, - PackTypes... args) + PTs... args) { while (*s) { base-commit: cdb4d27a4c2786cf1b1b0eb1872eac6a5f931578 prerequisite-patch-id: cf6b02f09f22e626404250f9e5fc33e6e0351db2 prerequisite-patch-id: 29fd7472d58735638f85059fd1678bba9acf7bf6 -- 2.48.1