This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto] Fix binfo streaming


This testcase exposed a bug in binfo streaming.  Circular references
between decls and binfo caused a segmentation fault because when
reserving space for a newly created DECL we were using a NULL
placeholder, which caused problem when we needed to reference it again
before it had been completely built.

Tested on x86_64.


Diego.


2008-09-12  Bill Maddox  <maddox@google.com>

        * lto-function-in.c (input_var_decl): Enter DECL in the
        global vector even if it's only partially read.

testsuite/ChangeLog.lto:

        * g++.dg/lto/20080912.C:

Index: lto-function-in.c
===================================================================
--- lto-function-in.c   (revision 140314)
+++ lto-function-in.c   (working copy)
@@ -2901,7 +2901,7 @@ input_var_decl (struct lto_input_block *
      we must reserve the slot in the globals vector here,
      because the writer allocates the indices before writing
      out the type, etc.  */
-  index = global_vector_enter (data_in, NULL, true);
+  index = global_vector_enter (data_in, decl, true);

   /* omit locus, uid */
   input_tree (&decl->decl_minimal.name, ib, data_in);
Index: testsuite/g++.dg/lto/20080912.C
===================================================================
--- testsuite/g++.dg/lto/20080912.C     (revision 0)
+++ testsuite/g++.dg/lto/20080912.C     (revision 0)
@@ -0,0 +1,4 @@
+// { dg-do assemble }
+class Foo { virtual void f(); };
+class Bar:public Foo { };
+void func() { Bar(); }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]