public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/100508] ICE with '-g -O3': in expand_debug_locations, at cfgexpand.c:5618
Date: Tue, 11 May 2021 08:31:50 +0000	[thread overview]
Message-ID: <bug-100508-4-l2ar0kQ6sZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100508-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If you change it to #pragma omp declare simd it will start certainly earlier.
I think the bug is in the inliner.
Before dse1 we have:
  V m;

  <bb 2> :
  m_2 = j;
  # DEBUG m => m_2
and dse1 turns that into:
  # DEBUG D#1 => j
  # DEBUG m => D#1
But it seems the inliner doesn't remap the DEBUG_EXPR_DECLs, which means they
are shared between different functions, and during expansion the corresponding
DEBUG_EXPRs are shared between the functions too:
    case DEBUG_EXPR_DECL:
      op0 = DECL_RTL_IF_SET (exp);

      if (op0)
        return op0;

      op0 = gen_rtx_DEBUG_EXPR (mode);
      DEBUG_EXPR_TREE_DECL (op0) = exp;
      SET_DECL_RTL (exp, op0);

      return op0;
because DECL_RTL will be set after expanding first function referencing that.

So, I guess one option is to remap DEBUG_EXPR_DECLs during inlining (and
function versioning etc.), but guess that would need to be done very carefully
for the DW_OP_GNU_parameter_ref case of optimized away arguments, another one
would be to clear DECL_RTL of DEBUG_EXPR_DECLs at the end of expansion (say
push DEBUG_EXPR_DECLs for which we SET_DECL_RTL into a vector and then walk the
vector and clear DECL_RTLs), or do this only for the vector type mode mismatch
case (ignore DECL_RTL in that case and therefore force a different DEBUG_EXPR).

  parent reply	other threads:[~2021-05-11  8:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 19:25 [Bug c/100508] New: " cnsun at uwaterloo dot ca
2021-05-11  7:02 ` [Bug middle-end/100508] " rguenth at gcc dot gnu.org
2021-05-11  8:10 ` marxin at gcc dot gnu.org
2021-05-11  8:31 ` jakub at gcc dot gnu.org [this message]
2021-05-11  9:34 ` jakub at gcc dot gnu.org
2021-05-12  8:40 ` cvs-commit at gcc dot gnu.org
2021-05-12 13:25 ` cvs-commit at gcc dot gnu.org
2021-05-12 13:25 ` jakub at gcc dot gnu.org
2022-05-10  8:17 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:19 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:34 ` jakub 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-100508-4-l2ar0kQ6sZ@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).