public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/97609] [11 Regression] ICE: tree check: expected tree that contains 'decl common' structure, have 'component_ref' in tree_could_trap_p, at tree-eh.c:2708
Date: Wed, 28 Oct 2020 16:38:14 +0000	[thread overview]
Message-ID: <bug-97609-4-Wk1yEjKSGT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97609-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
tl;dr: substitute_and_fold_engine::replace_uses_in() creates invalid gimple, so
when its loop goes on to request a range (value_of_expr), the ranger may see
invalid IL and die an ungraceful death.

The long story:

We are calling substitute_and_fold_engine::replace_uses_in() on the following
statement:

  <bb 3> :
  SR.2_9 = &__to_destroy._M_head;
  SR.1_10 = SR.2_9;
  __pos$_M_node_6 = SR.1_10;
  _11 = __pos$_M_node_6;
  _11->_M_next = __keep_12(D);  <-- HERE HERE

For _11, the call to value_of_expr() in replace_uses_in() returns:

  &__to_destroy._M_head;

which is propagated with propagate_value() and creates invalid gimple in the
process:

  __to_destroy._M_head._M_next = __keep_12(D);

The next time in the loop in replace_uses_in, we ask for
value_of_expr(__keep_12(D)), which dies deep in the call chain, because the IL
borked.

  parent reply	other threads:[~2020-10-28 16:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  4:46 [Bug tree-optimization/97609] New: " asolokha at gmx dot com
2020-10-28  9:47 ` [Bug tree-optimization/97609] " rguenth at gcc dot gnu.org
2020-10-28 11:00 ` aldyh at gcc dot gnu.org
2020-10-28 16:38 ` aldyh at gcc dot gnu.org [this message]
2020-10-28 16:48 ` aldyh at gcc dot gnu.org
2020-10-28 19:11 ` amacleod at redhat dot com
2020-10-28 20:24 ` amacleod at redhat dot com
2020-10-29  2:04 ` cvs-commit at gcc dot gnu.org
2020-10-29  8:47 ` marxin at gcc dot gnu.org
2020-10-29 11:17 ` aldyh at redhat dot com
2020-10-29 11:43 ` marxin 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-97609-4-Wk1yEjKSGT@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).