Hi, this patch fixes ICE when building firefox reported by Markus: > > lto1: internal compiler error: Segmentation fault > 0x106e1feb crash_signal > ../../gcc/gcc/toplev.c:383 > 0x10589cd4 lto_get_decl_name_mapping(lto_file_decl_data*, char const*) > ../../gcc/gcc/lto-section-in.c:369 > 0x1057bb6b copy_function_or_variable > ../../gcc/gcc/lto-streamer-out.c:2194 > 0x1057df9b lto_output() > ../../gcc/gcc/lto-streamer-out.c:2289 > 0x105edd87 write_lto > ../../gcc/gcc/passes.c:2405 > 0x105f3073 ipa_write_optimization_summaries(lto_symtab_encoder_d*) > ../../gcc/gcc/passes.c:2607 > 0x1018f6ab do_stream_out > ../../gcc/gcc/lto/lto.c:2480 > 0x10190a33 stream_out > ../../gcc/gcc/lto/lto.c:2544 > 0x10190a33 lto_wpa_write_files > ../../gcc/gcc/lto/lto.c:2661 > 0x1019c0a7 do_whole_program_analysis > ../../gcc/gcc/lto/lto.c:3331 > 0x1019c0a7 lto_main() > ../../gcc/gcc/lto/lto.c:3451 >
I tested it on Firefox, will commit after bootstrap®testing finishes (x86_64) Honza * ipa.c (symbol_table::remove_unreachable_nodes): Avoid releasing bodies of thunks; comment on why. * symtab.c (symtab_node::get_partitioning_class): Aliases of extern symbols are extern. Index: ipa.c =================================================================== --- ipa.c (revision 220608) +++ ipa.c (working copy) @@ -537,7 +537,13 @@ symbol_table::remove_unreachable_nodes ( /* If node is unreachable, remove its body. */ else if (!reachable.contains (node)) { - if (!body_needed_for_clonning.contains (node->decl)) + /* We keep definitions of thunks and aliases in the boundary so + we can walk to the ultimate alias targets and function symbols + reliably. */ + if (node->alias || node->thunk.thunk_p) + ; + else if (!body_needed_for_clonning.contains (node->decl) + && !node->alias && !node->thunk.thunk_p) node->release_body (); else if (!node->clone_of) gcc_assert (in_lto_p || DECL_RESULT (node->decl)); Index: symtab.c =================================================================== --- symtab.c (revision 220608) +++ symtab.c (working copy) @@ -1779,6 +1779,8 @@ symtab_node::get_partitioning_class (voi if (varpool_node *vnode = dyn_cast <varpool_node *> (this)) { + if (alias && definition && !ultimate_alias_target ()->definition) + return SYMBOL_EXTERNAL; /* Constant pool references use local symbol names that can not be promoted global. We should never put into a constant pool objects that can not be duplicated across partitions. */ @@ -1790,7 +1792,7 @@ symtab_node::get_partitioning_class (voi Handle them as external; compute_ltrans_boundary take care to make proper things to happen (i.e. to make them appear in the boundary but with body streamed, so clone can me materialized). */ - else if (!dyn_cast <cgraph_node *> (this)->definition) + else if (!dyn_cast <cgraph_node *> (this)->function_symbol ()->definition) return SYMBOL_EXTERNAL; /* Linker discardable symbols are duplicated to every use unless they are