[debug-early] Only output DW_TAG_GNU_formal_parameter_pack DIEs once
diff mbox

Message ID 5538346C.4050209@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez April 22, 2015, 11:53 p.m. UTC
The attached patch fixes 
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C.

The problem is that DW_TAG_GNU_formal_parameter_pack DIEs are generated 
multiple times (once for early dwarf and once for late dwarf).  Fixed by 
only outputting in early dwarf.

Tested with GCC and GDB testsuites.

Committed to branch.

Aldy
commit e74781aabb821c402a9c1efeb69a6311e4e905cf
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Apr 22 16:50:09 2015 -0700

    Only output DW_TAG_GNU_formal_parameter_pack DIEs once.

Patch
diff mbox

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7cc6bb5..624ed19 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19137,9 +19137,14 @@  gen_subprogram_die (tree decl, dw_die_ref context_die)
 	{
 	  if (generic_decl_parm
 	      && lang_hooks.function_parameter_pack_p (generic_decl_parm))
-	    gen_formal_parameter_pack_die (generic_decl_parm,
-					   parm, subr_die,
-					   &parm);
+	    {
+	      if (early_dwarf_dumping)
+		gen_formal_parameter_pack_die (generic_decl_parm,
+					       parm, subr_die,
+					       &parm);
+	      else if (parm)
+		parm = DECL_CHAIN (parm);
+	    }
 	  else if (parm && !POINTER_BOUNDS_P (parm))
 	    {
 	      dw_die_ref parm_die = gen_decl_die (parm, NULL, subr_die);