diff mbox series

Fix PR88046

Message ID alpine.LSU.2.20.1901151536330.23386@zhemvz.fhfr.qr
State New
Headers show
Series Fix PR88046 | expand

Commit Message

Richard Biener Jan. 15, 2019, 2:37 p.m. UTC
The following fixes one of the -g0 vs. -g with -flto issues by never
trying to generate inheritance DIEs late (since BINFOs have been
free-lang-data'ed).

Bootstrap & regtest running on x86_64-unknown-linux-gnu.

Richard.

2019-01-15  Richard Biener  <rguenther@suse.de>

	PR debug/88046
	* dwarf2out.c (gen_member_die): Do not generate inheritance
	DIEs late.

	* g++.dg/lto/pr88046_0.C: New testcase.
diff mbox series

Patch

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 267930)
+++ gcc/dwarf2out.c	(working copy)
@@ -25046,7 +25046,7 @@  gen_member_die (tree type, dw_die_ref co
      the TREE node representing the appropriate (containing) type.  */
 
   /* First output info about the base classes.  */
-  if (binfo)
+  if (binfo && early_dwarf)
     {
       vec<tree, va_gc> *accesses = BINFO_BASE_ACCESSES (binfo);
       int i;
Index: gcc/testsuite/g++.dg/lto/pr88046_0.C
===================================================================
--- gcc/testsuite/g++.dg/lto/pr88046_0.C	(nonexistent)
+++ gcc/testsuite/g++.dg/lto/pr88046_0.C	(working copy)
@@ -0,0 +1,14 @@ 
+// { dg-lto-do link }
+// { dg-lto-options { { -O2 -fPIC -flto } } }
+// { dg-extra-ld-options "-shared -g" }
+
+class a {};
+class b : virtual a {
+public:
+    void operator<<(bool);
+};
+void c() try {
+    b d;
+    d << "";
+} catch (int) {
+}