public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jamborm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/98078] ICE in cgraph_add_edge_to_call_site_hash, at cgraph.c:698 since r6-1705-gd88511aec7338a93
Date: Mon, 18 Jan 2021 19:21:54 +0000	[thread overview]
Message-ID: <bug-98078-4-S1sS7zJZry@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98078-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98078

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Here is what happens.  An IPA-CP clone for a particular
devirtualziation context is created but all devirtualziations based on
it are speculative.  Then the clone is inlined at one of its call
sites and the devirtualization turns out to be exactly right.  The
following goes on in cgraph_edge::set_call_stmt which gets a direct
call as the statement.

We end up in the update_speculative condition, which calls itself on
all the corresponding speculative edges.  First at the direct, which
then is removed and inserted into the call hash.  Then at the
indirect, which is not removed from the has because it is not the one
in there.  At this point, we figure out we have a direct call
statement at our hands and so we call make_direct at the edge, which
in turn simply resolves the speculation and returns the direct
branch, which we store to e.

And then we try to add e to call_site_hash, which is already there and
the assert condition does not take that possibility into account.

  (gdb) p/r *slot
  $42 = (cgraph_edge *) 0x7ffff74d6478
  (gdb) p/r e
  $43 = (cgraph_edge *) 0x7ffff74d6478


So the simplest fix is probably just adding
  if (*slot == e)
    return;
before the assert.

  parent reply	other threads:[~2021-01-18 19:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 10:09 [Bug ipa/98078] New: " marxin at gcc dot gnu.org
2020-12-01 10:09 ` [Bug ipa/98078] " marxin at gcc dot gnu.org
2020-12-01 10:10 ` marxin at gcc dot gnu.org
2021-01-18 19:21 ` jamborm at gcc dot gnu.org [this message]
2021-01-21 10:02 ` jamborm at gcc dot gnu.org
2021-03-05 16:42 ` cvs-commit at gcc dot gnu.org
2021-03-05 16:54 ` jamborm at gcc dot gnu.org
2021-03-16 15:44 ` cvs-commit at gcc dot gnu.org
2021-03-17 10:35 ` cvs-commit at gcc dot gnu.org
2021-03-17 10:36 ` jamborm at gcc dot gnu.org

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=bug-98078-4-S1sS7zJZry@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).