From: Eric Botcazou <ebotcazou@adacore.com>
To: gcc-patches@gcc.gnu.org
Subject: [patch] Fix ICE during LTRANS on big Ada application
Date: Mon, 06 Oct 2014 10:30:00 -0000 [thread overview]
Message-ID: <15700032.Vfff8vmhaG@polaris> (raw)
[-- Attachment #1: Type: text/plain, Size: 2517 bytes --]
Hi,
we have run into an ICE in LTO mode on a big Ada application with our 4.9-
based compiler, whose error message is:
xxxxxxxxxxxxxx.constprop.15627/1865799 (xxxxxxxxxxxxxxxxxxxxxxx.constprop)
@0x7ffff6835bd0
Type: function definition analyzed
Visibility: used_from_other_partition public visibility_specified
visibility:hidden artificial
References: __gnat_personality_v0/19663 (addr)__gnat_others_value/19664
(addr)
Referring:
Read from file: xxxxxx.ltrans31.o
Availability: local
First run: 0
Function flags: local
Called by:
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.constprop.15352/1865524
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.constprop.15343/1865515
Calls:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.constprop.15628/1865800
(1.00 per call)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.part.62.lto_priv.21947/1557884
(can throw external) __gnat_end_handler/19660 (can throw external)
__builtin_eh_pointer/20253 __gnat_begin_handler/19662 __gnat_end_handler/19660
(can throw external)
lto1: fatal error: xxxxxx.ltrans31.o: section
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.constprop.15627 is missing
So LTRANS complains that a .constprop function is missing on disk, which
doesn't really make sense since it's a clone so it is not streamed.
The problem is that a clone function has it clone_of field zeroed during clone
materialization by cgraph_node::remove:
/* We are removing node with clones. This makes clones inconsistent,
but assume they will be removed subsequently and just keep clone
tree intact. This can happen in unreachable function removal since
we remove unreachable functions in random order, not by bottom-up
walk of clone trees. */
for (n = clones; n; n = next)
{
next = n->next_sibling_clone;
n->next_sibling_clone = NULL;
n->prev_sibling_clone = NULL;
n->clone_of = NULL;
}
because it's the clone of an inlined_to node that gets discarded because it's
inlined into another clone(!). So the first clone function cannot (and is
never) materialized and the compiler ICEs later when its body is requested.
It seems to be that the root cause is clone_inlined_nodes overriding a master
clone that has non-inline clones, hence the attached patch.
Tested on x86_64-suse-linux, OK for the mainline?
2014-10-06 Eric Botcazou <ebotcazou@adacore.com>
* ipa-inline-transform.c (can_remove_node_now_p_1): Return false for a
master clone that has non-inline clones.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 789 bytes --]
Index: ipa-inline-transform.c
===================================================================
--- ipa-inline-transform.c (revision 215843)
+++ ipa-inline-transform.c (working copy)
@@ -82,6 +82,13 @@ update_noncloned_frequencies (struct cgr
static bool
can_remove_node_now_p_1 (struct cgraph_node *node)
{
+ /* We cannot remove a master clone that has non-inline clones until after
+ these clones are materialized. */
+ if (!node->clone_of)
+ for (struct cgraph_node *n = node->clones; n; n = n->next_sibling_clone)
+ if (n->decl != node->decl)
+ return false;
+
/* FIXME: When address is taken of DECL_EXTERNAL function we still
can remove its offline copy, but we would need to keep unanalyzed node in
the callgraph so references can point to it. */
next reply other threads:[~2014-10-06 10:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 10:30 Eric Botcazou [this message]
2014-10-15 18:06 ` Eric Botcazou
2014-10-15 20:06 ` Jan Hubicka
2014-10-16 15:15 ` Eric Botcazou
2014-10-17 20:02 ` Eric Botcazou
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=15700032.Vfff8vmhaG@polaris \
--to=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/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).