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 tree-optimization/94216] [10 Regression] ICE in maybe_canonicalize_mem_ref_addr, at gimple-fold.c:4899 since r10-7237-g4e3d3e40726e1b68bf52fa205c68495124ea60b8
Date: Wed, 18 Mar 2020 16:38:23 +0000	[thread overview]
Message-ID: <bug-94216-4-fjT06BhsNB@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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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);
+      if (arg0 != op0)
+       return fold_build2 (MEM_REF, type, arg0, op1);
+
       /* MEM[&MEM[p, CST1], CST2] -> MEM[p, CST1 + CST2].  */
       if (TREE_CODE (arg0) == ADDR_EXPR
          && TREE_CODE (TREE_OPERAND (arg0, 0)) == MEM_REF)
to catch all similar issues.  Otherwise, we'd need to strip the useless type
conversion at least in the case which triggers this:
          return fold_build2 (MEM_REF, type,
                              build_fold_addr_expr (base),
                              int_const_binop (PLUS_EXPR, arg1,
                                               size_int (coffset)));
a few lines below this, where build_fold_addr_expr now returns a NOP_EXPR that
we really want to strip again, even when op0 wasn't a NOP_EXPR.

  parent reply	other threads:[~2020-03-18 16:38 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 [this message]
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

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-fjT06BhsNB@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).