http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51650
--- Comment #16 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-23 11:13:20 UTC --- We can fix the resolution with Index: gcc/lto-symtab.c =================================================================== --- gcc/lto-symtab.c (revision 182652) +++ gcc/lto-symtab.c (working copy) @@ -715,6 +715,14 @@ lto_symtab_merge_cgraph_nodes_1 (void ** { lto_symtab_entry_t e, prevailing = (lto_symtab_entry_t) *slot; + if (prevailing->guessed) + { + if (prevailing->node) + prevailing->node->resolution = prevailing->resolution; + if (prevailing->vnode) + prevailing->vnode->resolution = prevailing->resolution; + } + if (!prevailing->next) return 1; but still the local static is marked needed because of if (node->finalized) varpool_mark_needed_node (node); in input_varpool_node. Not sure why we stream that flag at all? Surely whether to output sth is to be still decided? I would say sth like Index: gcc/lto-cgraph.c =================================================================== --- gcc/lto-cgraph.c (revision 182652) +++ gcc/lto-cgraph.c (working copy) @@ -1080,6 +1080,8 @@ input_varpool_node (struct lto_file_decl DECL_EXTERNAL (node->decl) = 1; TREE_STATIC (node->decl) = 0; } + if (!flag_ltrans) + node->finalized = 0; if (node->finalized) varpool_mark_needed_node (node); if (non_null_aliasof) is in order, or a similar Index: gcc/lto-cgraph.c =================================================================== --- gcc/lto-cgraph.c (revision 182652) +++ gcc/lto-cgraph.c (working copy) @@ -565,7 +565,7 @@ lto_output_varpool_node (struct lto_simp bp = bitpack_create (ob->main_stream); bp_pack_value (&bp, node->externally_visible, 1); bp_pack_value (&bp, node->force_output, 1); - bp_pack_value (&bp, node->finalized, 1); + bp_pack_value (&bp, in_lto_p && node->finalized, 1); bp_pack_value (&bp, node->alias, 1); bp_pack_value (&bp, node->alias_of != NULL, 1); gcc_assert (node->finalized || !node->analyzed); Honza?