public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/98599] fatal error: Cgraph edge statement index out of range with -Os -flto -fanalyzer
Date: Fri, 08 Jan 2021 23:56:27 +0000	[thread overview]
Message-ID: <bug-98599-4-EyNmMCN2ie@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98599-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
As far as I can tell, there are two invocations of lto1: wpa, then ltrans.

The analyzer is run in the first invocation.

The analyzer updates the gimple stmt uids; if I disable this updating the crash
doesn't happen.

The crash happens in the 2nd invocation of lto1 at:
    1200          for (cedge = node->indirect_calls; cedge; cedge =
cedge->next_callee)
    1201            {
    1202              if (STMT_UID_NOT_IN_RANGE (cedge->lto_stmt_uid))
    1203                fatal_error (input_location,
    1204                             "Cgraph edge statement index out of
range");

I haven't managed to fully debug this yet, but it looks like the stmt uids are
stored into the callgraph edge's lto_stmt_uid, and somewhere between the cgraph
and LTO infrastructure it doesn't expect an IPA pass (the analyzer) to change
the uids in the stmts from under it, even though gimple.h has this for the stmt
field:

  /* UID of this statement.  This is used by passes that want to
     assign IDs to statements.  It must be assigned and used by each
     pass.  By default it should be assumed to contain garbage.  */
  unsigned uid;

and gimple_set_uid has:

   Please note that this UID property is supposed to be undefined at
   pass boundaries.  This means that a given pass should not assume it
   contains any useful value when the pass starts and thus can set it
   to any value it sees fit.

  parent reply	other threads:[~2021-01-08 23:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 10:59 [Bug analyzer/98599] New: " acoplan at gcc dot gnu.org
2021-01-08 16:36 ` [Bug analyzer/98599] " dmalcolm at gcc dot gnu.org
2021-01-08 23:56 ` dmalcolm at gcc dot gnu.org [this message]
2021-01-11 12:47 ` marxin at gcc dot gnu.org
2021-01-11 16:29 ` dmalcolm at gcc dot gnu.org
2021-01-12 13:27 ` marxin at gcc dot gnu.org
2021-01-12 23:26 ` dmalcolm at gcc dot gnu.org
2021-01-13 10:31 ` marxin at gcc dot gnu.org
2021-01-13 18:38 ` dmalcolm at gcc dot gnu.org
2021-01-13 22:09 ` dmalcolm at gcc dot gnu.org
2021-03-11 18:04 ` dmalcolm at gcc dot gnu.org
2021-03-31 18:28 ` dmalcolm at gcc dot gnu.org
2021-04-10 17:42 ` [Bug analyzer/98599] [11 Regression] " dmalcolm at gcc dot gnu.org
2021-04-13  1:15 ` cvs-commit at gcc dot gnu.org
2021-04-13  1:16 ` dmalcolm at gcc dot gnu.org
2021-04-13  7:55 ` hubicka at ucw dot cz
2021-04-13  9:09 ` acoplan at gcc dot gnu.org
2021-04-13 18:26 ` dmalcolm at gcc dot gnu.org
2021-04-15  9:41 ` cvs-commit 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-98599-4-EyNmMCN2ie@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).