public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/94216] [10 Regression] ICE in maybe_canonicalize_mem_ref_addr, at gimple-fold.c:4899 since r10-7237-g4e3d3e40726e1b68bf52fa205c68495124ea60b8
Date: Thu, 19 Mar 2020 14:56:55 +0000 [thread overview]
Message-ID: <bug-94216-4-uozwe2uhU2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94216-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94216
--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 19 Mar 2020, Richard Biener wrote:
> On Thu, 19 Mar 2020, jakub at gcc dot gnu.org wrote:
>
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94216
> >
> > --- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> > (In reply to Richard Biener from comment #5)
> > > (In reply to Jakub Jelinek from comment #1)
> > > > I wonder if we shouldn't do:
> > > > --- gcc/fold-const.c.jj 2020-03-18 12:47:36.000000000 +0100
> > > > +++ gcc/fold-const.c 2020-03-18 17:34:14.586455801 +0100
> > > > @@ -82,6 +82,7 @@ along with GCC; see the file COPYING3.
> > > > #include "attribs.h"
> > > > #include "tree-vector-builder.h"
> > > > #include "vec-perm-indices.h"
> > > > +#include "tree-ssa.h"
> > > >
> > > > /* Nonzero if we are folding constants inside an initializer; zero
> > > > otherwise. */
> > > > @@ -10262,6 +10263,10 @@ fold_binary_loc (location_t loc, enum tr
> > > > switch (code)
> > > > {
> > > > case MEM_REF:
> > > > + STRIP_USELESS_TYPE_CONVERSION (arg0);
> > >
> > > We already applied STRIP_NOPS to arg0
> >
> > Though, if we don't want to strip non-useless conversions, that is wrong even
> > for the two special cases we have afterwards.
> > So, shouldn't case MEM_REF: start then with
> > arg0 = op0;
> > STRIP_USELESS_TYPE_CONVERSION (arg0);
> > arg1 = op1;
> > ?
>
> While we "abuse" fold_binary (MEM_REF,...) to make MEM_REFs valid
> we still expect some basic hygiene there..
>
> > Or fold_convert to the type of op0 if the type conversion isn't useless?
> > Also, isn't the arg1 handling incorrect or at least dangerous?
> > I mean, if it does int_const_binop (PLUS_EXPR, arg1, ...) in both cases
> > then it will have the type of arg1 which is op1 after STRIP_NOPS, so could have
> > completely different type. One needs to hope that the last argument to
> > fold_binary_loc of MEM_REF will always be an INTEGER_CST from which nothing can
> > be stripped...
>
> ..for example INTEGER_CST 2nd argument (implicit in the use of
> int_const_binop). For the 2nd arg we could be more explicit and
> instead of arg1 use op1. Likewise we should probably use
>
> if (TREE_CODE (op0) == ADDR_EXPR
> && TREE_CODE (TREE_OPERAND (op0, 0)) == MEM_REF)
>
> that is, we don't even expect to need to strip nops here. I'll try
> to bootstrap/test such changes to see where other possible issues
> in fold_build_addr_expr callers lie...
That worked well without any further visible fallout.
prev parent reply other threads:[~2020-03-19 14:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 15:47 [Bug tree-optimization/94216] New: " marxin at gcc dot gnu.org
2020-03-18 15:47 ` [Bug tree-optimization/94216] " marxin at gcc dot gnu.org
2020-03-18 16:38 ` jakub at gcc dot gnu.org
2020-03-18 17:23 ` xerofoify at gmail dot com
2020-03-18 17:27 ` jakub at gcc dot gnu.org
2020-03-19 6:40 ` rguenth at gcc dot gnu.org
2020-03-19 6:55 ` rguenth at gcc dot gnu.org
2020-03-19 9:18 ` cvs-commit at gcc dot gnu.org
2020-03-19 9:18 ` rguenth at gcc dot gnu.org
2020-03-19 11:44 ` jakub at gcc dot gnu.org
2020-03-19 11:51 ` rguenther at suse dot de
2020-03-19 14:56 ` rguenther at suse dot de [this message]
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-94216-4-uozwe2uhU2@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).