From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C8F4D3858292; Wed, 6 Dec 2023 08:56:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8F4D3858292 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701852997; bh=QZ5NqRkXUXvWWLfoEbaNrVXAvW45U1CAW8Oug6z/Mos=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YJ112B9RCb2Fbrgm4eH3PRExW0s8UHAhLqkDs9XK79uBpuwXH1wa0/v2aLc+KADrw KRLdRDgexA16XUwUetqWc76++RfnrAhgJMEEdwIrk7yOFnvfZDsGJaNG+Xs0A8IIB2 IjUomri3qeejTrjjnc3lRhO/WQa8mnSVlWvbgk08= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112809] during GIMPLE pass: bitintlower ICE: in limb_access_type, at gimple-lower-bitint.cc:563 at -O1 and above Date: Wed, 06 Dec 2023 08:56:37 +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: 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: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D112809 --- Comment #3 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:0ca64f846edce3c7b7f26bcc5978118e560e65b1 commit r14-6209-g0ca64f846edce3c7b7f26bcc5978118e560e65b1 Author: Jakub Jelinek Date: Wed Dec 6 09:55:30 2023 +0100 lower-bitint: Fix arithmetics followed by extension by many bits [PR112= 809] A zero or sign extension from result of some upwards_2limb operation is implemented in lower_mergeable_stmt as an extra loop which fills in the extra bits with 0s or 1s. If the delta of extended vs. unextended bit count is small, the code doesn't use a loop and emits up to a couple of stores to constant index= es, but if the delta is large, it uses cnt =3D (bo_bit !=3D 0) + 1 + (rem !=3D 0); statements. bo_bit is non-zero for bit-field loads and is done in that case as straight line, the unconditional 1 in there is for a loop which handles most of the limbs in the delta and finally (rem !=3D 0) is for = the case when the extended precision is not a multiple of limb_prec and is again done in straight line code (after the loop). The testcase ICEs because the decision what idx to use was incorrect for kind =3D=3D bitint_prec_huge (i.e. when the precision delta is very= large) and rem =3D=3D 0 (i.e. the extended precision is multiple of limb_prec). In that case cnt is either 1 (if bo_bit =3D=3D 0) or 2, and idx should be either first size_int (start) and then result of create_loop (for bo= _bit !=3D 0) or just result of create_loop, but by mistake the last case was size_int (end), which means when precision is multiple of limb_prec storing above the precision (which ICEs; but also not emitting the loop which is needed). 2023-12-06 Jakub Jelinek PR tree-optimization/112809 * gimple-lower-bitint.cc (bitint_large_huge::lower_mergeable_st= mt): For separate_ext in kind =3D=3D bitint_prec_huge mode if rem =3D=3D= 0, create for i =3D=3D cnt - 1 the loop rather than using size_int (end). * gcc.dg/bitint-48.c: New test.=