re PR debug/71855 (duplicate unspecified_parameters DIE in DWARF for functions with...
authorAldy Hernandez <aldyh@redhat.com>
Tue, 19 Jul 2016 19:29:42 +0000 (19:29 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Tue, 19 Jul 2016 19:29:42 +0000 (19:29 +0000)
PR debug/71855
* dwarf2out.c (gen_subprogram_die): Only call
gen_unspecified_parameters_die while dumping early dwarf.

From-SVN: r238488

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c [new file with mode: 0644]

index a59b4b3f40e41d57f8383a4691fd7eed3d49c3a3..351195143120bc0ed46c9086d23b7d6a28827c18 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-19  Aldy Hernandez  <aldyh@redhat.com>
+
+       PR debug/71855
+       * dwarf2out.c (gen_subprogram_die): Only call
+       gen_unspecified_parameters_die while dumping early dwarf.
+
 2016-07-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/71874
index 9da2b3bf4d40d778f0e490c0d3f1c60645c1d6de..e3cb586ce11070378023a9d426041c13f7c983bb 100644 (file)
@@ -20726,14 +20726,17 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
         void_type_node 2) an unprototyped function declaration (not a
         definition).  This just means that we have no info about the
         parameters at all.  */
-      if (prototype_p (TREE_TYPE (decl)))
+      if (early_dwarf)
        {
-         /* This is the prototyped case, check for....  */
-         if (stdarg_p (TREE_TYPE (decl)))
+         if (prototype_p (TREE_TYPE (decl)))
+           {
+             /* This is the prototyped case, check for....  */
+             if (stdarg_p (TREE_TYPE (decl)))
+               gen_unspecified_parameters_die (decl, subr_die);
+           }
+         else if (DECL_INITIAL (decl) == NULL_TREE)
            gen_unspecified_parameters_die (decl, subr_die);
        }
-      else if (DECL_INITIAL (decl) == NULL_TREE)
-       gen_unspecified_parameters_die (decl, subr_die);
     }
 
   if (subr_die != old_die)
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c
new file mode 100644 (file)
index 0000000..4fd8b74
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -g -dA" } */
+
+// Test that there is only one DW_TAG_unspecified_parameters DIE.
+
+void
+foo (const char *format, ...)
+{
+}
+
+// { dg-final { scan-assembler-times "DIE.*DW_TAG_unspecified_parameters" 1 } }