From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A0B3638582B7; Fri, 2 Feb 2024 10:26:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0B3638582B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706869619; bh=I6499P1EMShiMVc9aUwxTXoM1ziN48EmI+847d7ASH8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Yz9BtwZBWXsQDJ2plZV48aSoodI+I9OIpSa7L++KWsiv5huOXQD3lRpef11fwHy3Q nUCkX+VDjG2jhcMIiCR2/oZy4QGuzifAaG8wlWiIi2AdWYd6GL/n6hZOl5GKqOc5Cf /CAkFo30FLZEPkJ6oCVNZKKweMbgPg/zsCnikF/g= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113705] [14 Regression] ICE in decompose, at wide-int.h:1049 on aarch64-linux-gnu since r14-8680-g2f14c0dbb78985 Date: Fri, 02 Feb 2024 10:26:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113705 --- Comment #10 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:a8f335ccb61bf6105192a4197ef2d84900614dc1 commit r14-8742-ga8f335ccb61bf6105192a4197ef2d84900614dc1 Author: Jakub Jelinek Date: Fri Feb 2 11:25:13 2024 +0100 tree-ssa-math-opts: Fix is_widening_mult_rhs_p - unbreak bootstrap [PR113705] On Tue, Jan 30, 2024 at 07:33:10AM -0000, Roger Sayle wrote: + wide_int bits =3D wide_int::from (tree_nonzero_bits (rhs), + prec, + TYPE_SIGN (TREE_TYPE (rhs= ))); ... > + if (gimple_assign_rhs_code (stmt) =3D=3D BIT_AND_EXPR > + && TREE_CODE (gimple_assign_rhs2 (stmt)) =3D=3D INTEGER_CST > + && wi::to_wide (gimple_assign_rhs2 (stmt)) > + =3D=3D wi::mask (hprec, false, prec)) This change broke bootstrap on aarch64-linux. The problem can be seen even on the reduced testcase. The IL on the unreduced testcase before widening_mul has: # val_583 =3D PHI ... pretmp_266 =3D MEM[(const struct wide_int_storage *)&D.160657].len; _264 =3D pretmp_266 & 65535; ... _176 =3D (sizetype) val_583; _439 =3D (sizetype) _264; _284 =3D _439 * 8; _115 =3D _176 + _284; where 583/266/264 have unsigned int type and 176/439/284/115 have sizet= ype. widening_mul first turns that into: # val_583 =3D PHI ... pretmp_266 =3D MEM[(const struct wide_int_storage *)&D.160657].len; _264 =3D pretmp_266 & 65535; ... _176 =3D (sizetype) val_583; _439 =3D (sizetype) _264; _284 =3D _264 w* 8; _115 =3D _176 + _284; and then is_widening_mult_rhs_p is called, with type sizetype (64-bit), rhs _264, hprec 32 and prec 64. Now tree_nonzero_bits (rhs) is 65535, so bits is 64-bit wide_int 65535, stmt is BIT_AND_EXPR, but we ICE on the wi::to_wide (gimple_assign_rhs2 (stmt)) =3D=3D wi::mask (hprec, false, = prec) comparison because wi::to_wide on gimple_assign_rhs2 (stmt) - unsigned = int 65535 gives 32-bit wide_int 65535, while wi::mask (hprec, false, prec) gives 64-bit wide_int 0xffffffff and comparison between different preci= sion wide_ints is forbidden. The following patch fixes it the same way how bits is computed earlier, by calling wide_int::from on the wi::to_wide (gimple_assign_rhs2 (stmt)= ), so we compare 64-bit 65535 with 64-bit 0xffffffff. 2024-02-02 Jakub Jelinek PR middle-end/113705 * tree-ssa-math-opts.cc (is_widening_mult_rhs_p): Use wide_int_= from around wi::to_wide in order to compare value in prec precision. * g++.dg/opt/pr113705.C: New test.=