public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [lto] Fix binfo streaming
@ 2008-09-12 14:35 Diego Novillo
  0 siblings, 0 replies; only message in thread
From: Diego Novillo @ 2008-09-12 14:35 UTC (permalink / raw)
  To: gcc-patches

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(); }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-12 14:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-12 14:35 [lto] Fix binfo streaming Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).