From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: Jan Hubicka <hubicka@ucw.cz>
Subject: [PATCH] Fix LTO early-debug ICE wrt abstract origin node streaming
Date: Fri, 28 Aug 2015 08:56:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.11.1508281026250.4884@zhemvz.fhfr.qr> (raw)
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 <rguenther@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 <rguenther@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);
}
next reply other threads:[~2015-08-28 8:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-28 8:56 Richard Biener [this message]
2015-08-28 9:40 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.11.1508281026250.4884@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).