From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BD31F385828B; Wed, 17 Jan 2024 12:57:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BD31F385828B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705496270; bh=aIsTlXsz5GN1U9VYrhwFmXVDKqEjzbpy1KewD/UpVpg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yY+Vunk4CBVZyXlVootgvvApapqU1Hz1Tl8HDPDTRdP95I95gUK2TcRjDDut3xDmY JDs89HeNdZ8Z4gf62E7m7mGqWVyw7Fyl3OoJ5bx58egs3+E0bQf7doZT7y+cHqIKM9 0EBV3jOQ+zlq+5t80mVVaQ09qRozb9dBs6IFmkUU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113410] ICE: in maybe_check_access_sizes, at gimple-ssa-warn-access.cc:3423 with _BitInt() used as array length Date: Wed, 17 Jan 2024 12:57:50 +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: diagnostic, ice-checking, 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=3D113410 --- Comment #3 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:a98a24ac65c1a0ee598e5b54d9e4c921a9744a08 commit r14-8185-ga98a24ac65c1a0ee598e5b54d9e4c921a9744a08 Author: Jakub Jelinek Date: Wed Jan 17 13:57:07 2024 +0100 gimple-ssa-warn-access: Cast huge params to sizetype before using them = in maybe_check_access_sizes [PR113410] WHen a VLA is created with some very high precision size expression (say __int128, or _BitInt(65535) etc.), we cast it to sizetype, because we can't have arrays longer than what can be expressed in sizetype. But the maybe_check_access_sizes code when trying to determine ranges wasn't doing this but was using fixed buffers for the sizes. While __int128 could still be handled (fit into the buffers), obviously arbitrary _BitInt parameter ranges can't, they can be in the range of up to almost 20KB per number. It doesn't make sense to print such ranges though, no array can be larger than sizetype precision, and ranger's range_of_expr can handle NOP_EXPRs/CONVERT_EXPRs wrapping a PARM_DECL just fine, so the following patch just casts the excessively large counters for the range determination purposes to sizetype. 2024-01-17 Jakub Jelinek PR middle-end/113410 * gimple-ssa-warn-access.cc (pass_waccess::maybe_check_access_sizes): If access_nelts is integral with larger precision than sizetype, fold_convert it to sizetype. * gcc.dg/bitint-72.c: New test.=