From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 291503945C13; Wed, 18 Mar 2020 16:38:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 291503945C13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584549504; bh=e54xRfgASHgEZeboXf+qucWcBh0S+ufJf1QCAsr6mpE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QMf0p0/FMh16cEZXXuI/cGkarKzX4QSuHlEl07yjKo3sj6FM0VNXx8DaHntBf3R8z YpTkLlMJXz4zpNYCyI+TH1lPHz/L+5xaBH6iRPNQDConzUJZCgQeHWqmJJZz2PCuK5 3x+UVz8vzESnF/ePMtWF2vGYAFgu0MvDh99Ilz/M= From: "jakub at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2020 16:38:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94216 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek --- 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 !=3D op0) + return fold_build2 (MEM_REF, type, arg0, op1); + /* MEM[&MEM[p, CST1], CST2] -> MEM[p, CST1 + CST2]. */ if (TREE_CODE (arg0) =3D=3D ADDR_EXPR && TREE_CODE (TREE_OPERAND (arg0, 0)) =3D=3D 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 t= hat we really want to strip again, even when op0 wasn't a NOP_EXPR.=