Blame SOURCES/gcc10-pr97060.patch

00b2fc
2020-11-11  Jason Merrill  <jason@redhat.com>
00b2fc
00b2fc
	PR debug/97060
00b2fc
	* dwarf2out.c (gen_subprogram_die): It's a declaration
00b2fc
	if DECL_INITIAL isn't set.
00b2fc
00b2fc
	* gcc.dg/debug/dwarf2/pr97060.c: New test.
00b2fc
00b2fc
--- gcc/dwarf2out.c
00b2fc
+++ gcc/dwarf2out.c
00b2fc
@@ -22859,6 +22859,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
00b2fc
           available.
00b2fc
   */
00b2fc
   int declaration = (current_function_decl != decl
00b2fc
+		     || (!DECL_INITIAL (decl) && !origin)
00b2fc
 		     || class_or_namespace_scope_p (context_die));
00b2fc
 
00b2fc
   /* A declaration that has been previously dumped needs no
00b2fc
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr97060.c
00b2fc
+++ gcc/testsuite/gcc.dg/debug/dwarf2/pr97060.c
00b2fc
@@ -0,0 +1,13 @@
00b2fc
+/* PR debug/97060 */
00b2fc
+/* { dg-do compile } */
00b2fc
+/* { dg-options "-g -dA" } */
00b2fc
+/* { dg-final { scan-assembler-times "DW_AT_declaration" 2 } } */
00b2fc
+
00b2fc
+extern int foo (unsigned int, unsigned int);
00b2fc
+
00b2fc
+int
00b2fc
+bar (void)
00b2fc
+{
00b2fc
+  foo (1, 2);
00b2fc
+  return 0;
00b2fc
+}