[PATCH] Fix PR88046

Richard Biener rguenther@suse.de
Tue Jan 15 14:38:00 GMT 2019


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.

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) {
+}



More information about the Gcc-patches mailing list