The following fixes Program received signal SIGSEGV, Segmentation fault. 0x0000000000af8edd in lto_get_decl_name_mapping (decl_data=0x0, name=0x7ffff68dcbd0 "bar") at /space/rguenther/src/svn/trunk/gcc/lto-section-in.c:349 349 htab_t renaming_hash_table = decl_data->renaming_hash_table; (gdb) bt #0 0x0000000000af8edd in lto_get_decl_name_mapping (decl_data=0x0, name=0x7ffff68dcbd0 "bar") at /space/rguenther/src/svn/trunk/gcc/lto-section-in.c:349 #1 0x0000000000af41b9 in copy_function_or_variable (node=0x7ffff6abfb80) at /space/rguenther/src/svn/trunk/gcc/lto-streamer-out.c:2233 #2 0x0000000000af4701 in lto_output () at /space/rguenther/src/svn/trunk/gcc/lto-streamer-out.c:2328 #3 0x0000000000b6d909 in write_lto () at /space/rguenther/src/svn/trunk/gcc/passes.c:2411 #4 0x0000000000b6e062 in ipa_write_optimization_summaries (encoder=0x2100ab0) at /space/rguenther/src/svn/trunk/gcc/passes.c:2615
I see quite often because I now stream DECL_ABSTRACT_ORIGIN from the early compile. Often the abstract origins have their bodies removed as unreachable but LTRANS boundary compute happily re-creates the cgraph nodes and tries to stream the bodies. Which obviously fails. Below are two possible fixes (and in fact I believe that with early LTO debug we do _not_ need to put abstract origins into the LTRANS boundary at all - the abstract instance is available from the early debug via the abstract origin decl). Any preference? I'm LTO bootstrapping the first one because it looks bogus to use get_create here (did we add this for dwarf2out ICEs with LTO?) Maybe we want the cgraph_node::remove hunk as well and assert in cgraph_node::create that we are not creating cgraph nodes for DECL_ABSTRACT_P decls... Thanks, Richard. 2015-08-28 Richard Biener <rguent...@suse.de> * lto-cgraph.c (compute_ltrans_boundary): Only put abstract origin nodes into the ltrans boundary if their body is still available. Index: trunk/gcc/lto-cgraph.c =================================================================== --- trunk.orig/gcc/lto-cgraph.c 2015-08-13 13:14:09.116378573 +0200 +++ trunk/gcc/lto-cgraph.c 2015-08-28 10:24:05.130397851 +0200 @@ -899,9 +899,12 @@ compute_ltrans_boundary (lto_symtab_enco if (DECL_ABSTRACT_ORIGIN (node->decl)) { struct cgraph_node *origin_node - = cgraph_node::get_create (DECL_ABSTRACT_ORIGIN (node->decl)); - origin_node->used_as_abstract_origin = true; - add_node_to (encoder, origin_node, true); + = cgraph_node::get (DECL_ABSTRACT_ORIGIN (node->decl)); + if (origin_node) + { + origin_node->used_as_abstract_origin = true; + add_node_to (encoder, origin_node, true); + } } } for (lsei = lsei_start_variable_in_partition (in_encoder); 2015-08-28 Richard Biener <rguent...@suse.de> * cgraph.c (cgraph_node::remove): If the node was used as abstract origin mark the decl as abstract. * lto-cgraph.c (compute_ltrans_boundary): Do not put abstract nodes in the ltrans boundary. Index: trunk/gcc/cgraph.c =================================================================== --- trunk.orig/gcc/cgraph.c 2015-08-13 13:13:56.942263721 +0200 +++ trunk/gcc/cgraph.c 2015-08-28 10:03:06.841844184 +0200 @@ -1840,6 +1840,9 @@ cgraph_node::remove (void) lto_file_data = NULL; } + if (used_as_abstract_origin) + DECL_ABSTRACT_P (decl) = 1; + decl = NULL; if (call_site_hash) { Index: trunk/gcc/lto-cgraph.c =================================================================== --- trunk.orig/gcc/lto-cgraph.c 2015-08-13 13:14:09.116378573 +0200 +++ trunk/gcc/lto-cgraph.c 2015-08-28 10:12:13.944867635 +0200 @@ -896,10 +896,12 @@ compute_ltrans_boundary (lto_symtab_enco lto_set_symtab_encoder_in_partition (encoder, node); create_references (encoder, node); /* For proper debug info, we need to ship the origins, too. */ - if (DECL_ABSTRACT_ORIGIN (node->decl)) + if (DECL_ABSTRACT_ORIGIN (node->decl) + /* ??? But we might have removed it! */ + && ! DECL_ABSTRACT_P (DECL_ABSTRACT_ORIGIN (node->decl))) { struct cgraph_node *origin_node - = cgraph_node::get_create (DECL_ABSTRACT_ORIGIN (node->decl)); + = cgraph_node::get (DECL_ABSTRACT_ORIGIN (node->decl)); origin_node->used_as_abstract_origin = true; add_node_to (encoder, origin_node, true); }