re PR lto/81940 (internal compiler error: in dwarf2out_abstract_function, at dwarf2ou...
authorRichard Biener <rguenther@suse.de>
Wed, 23 Aug 2017 12:11:03 +0000 (12:11 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 23 Aug 2017 12:11:03 +0000 (12:11 +0000)
2017-08-23  Richard Biener  <rguenther@suse.de>

PR lto/81940
* dwarf2out.c (dwarf2out_abstract_function): Handle LTO with
-g0 at compile-time.

* g++.dg/lto/pr81940_0.C: New testcase.

From-SVN: r251306

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/pr81940_0.C [new file with mode: 0644]

index 37be75b..4d221a2 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-23  Richard Biener  <rguenther@suse.de>
+
+       PR lto/81940
+       * dwarf2out.c (dwarf2out_abstract_function): Handle LTO with
+       -g0 at compile-time.
+
 2017-08-23  Tamar Christina  <tamar.christina@arm.com>
 
        PR middle-end/19706
index 0c339bd..ba8d24b 100644 (file)
@@ -21609,7 +21609,10 @@ dwarf2out_abstract_function (tree decl)
     return;
 
   old_die = lookup_decl_die (decl);
-  /* With early debug we always have an old DIE.  */
+  /* With early debug we always have an old DIE unless we are in LTO
+     and the user did not compile but only link with debug.  */
+  if (in_lto_p && ! old_die)
+    return;
   gcc_assert (old_die != NULL);
   if (get_AT (old_die, DW_AT_inline)
       || get_AT (old_die, DW_AT_abstract_origin))
index 487d94b..ff50edf 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-23  Richard Biener  <rguenther@suse.de>
+
+       PR lto/81940
+       * g++.dg/lto/pr81940_0.C: New testcase.
+
 2017-08-23  Tamar Christina  <tamar.christina@arm.com>
 
        PR middle-end/19706
diff --git a/gcc/testsuite/g++.dg/lto/pr81940_0.C b/gcc/testsuite/g++.dg/lto/pr81940_0.C
new file mode 100644 (file)
index 0000000..4eba5fd
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -O -flto } } }
+// { dg-extra-ld-options "-r -nostdlib -g" }
+
+int a, b = a;