> Jan Hubicka <hubi...@ucw.cz> writes:
> 
> > this patch moves init and fini priorities to symbol table instead of trees.
> > They are already in on-side hashtables, but the hashtables are now maintaned
> > by symbol table.  This is needed for correctness with LTO.
> 
> This breaks gcc.dg/initpri3.c.  The constructor and destructor are
> miscompiled to unconditionally call abort.

Sorry for that. This is caused by lto-cgraph using the set_decl_init_priority 
that
it should not.  I am sure I updated this once already.  This patch fixes the 
problem.

Bootstrapped/regtested x86_64-linux, comitted.

        * lto-cgraph.c (lto_output_node, input_node): Set/get init/fini priority
        directly.
Index: lto-cgraph.c
===================================================================
--- lto-cgraph.c        (revision 211881)
+++ lto-cgraph.c        (working copy)
@@ -558,9 +558,9 @@ lto_output_node (struct lto_simple_outpu
     }
   streamer_write_hwi_stream (ob->main_stream, node->profile_id);
   if (DECL_STATIC_CONSTRUCTOR (node->decl))
-    streamer_write_hwi_stream (ob->main_stream, DECL_INIT_PRIORITY 
(node->decl));
+    streamer_write_hwi_stream (ob->main_stream, node->get_init_priority ());
   if (DECL_STATIC_DESTRUCTOR (node->decl))
-    streamer_write_hwi_stream (ob->main_stream, DECL_FINI_PRIORITY 
(node->decl));
+    streamer_write_hwi_stream (ob->main_stream, node->get_fini_priority ());
 }
 
 /* Output the varpool NODE to OB. 
@@ -1215,9 +1216,9 @@ input_node (struct lto_file_decl_data *f
     node->alias_target = get_alias_symbol (node->decl);
   node->profile_id = streamer_read_hwi (ib);
   if (DECL_STATIC_CONSTRUCTOR (node->decl))
-    SET_DECL_INIT_PRIORITY (node->decl, streamer_read_hwi (ib));
+    node->set_init_priority (streamer_read_hwi (ib));
   if (DECL_STATIC_DESTRUCTOR (node->decl))
-    SET_DECL_FINI_PRIORITY (node->decl, streamer_read_hwi (ib));
+    node->set_fini_priority (streamer_read_hwi (ib));
   return node;
 }
 

Reply via email to