From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4BF283858D28; Tue, 29 Nov 2022 17:54:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BF283858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669744460; bh=5rzkzYpmOHZ2FISilyuBtbH7v1+pAwaowfpNP43DzUg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GllEJDqR70d3Dv/rvUxivVjzqwLxfX+SWZ5hmxrhontGLrtsr0qgzSVfwykBlIqox h5wPTi8wTqxjrNbypQH5dtpfHDeovXdiwrvw74+reeJGYZeOlimV0VAOgrBDadh3QV 0r4H/zYb4ZqcHj8QKqv7Q905I6Wu8muG/0X48QmI= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107699] [12/13 Regression] False positive -Warray-bounds, non-existent offset reported by GCC Date: Tue, 29 Nov 2022 17:54:19 +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: 13.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 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=3D107699 --- Comment #7 from rguenther at suse dot de --- On Tue, 29 Nov 2022, carlosgalvezp at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107699 >=20 > --- Comment #5 from Carlos Galvez --- > > is not good programming practice. >=20 > Sure. In the real world, we have asserts for this. However this is a prob= lem > when we build for Release mode, in which asserts are disabled and thus th= is > warning pops up. Ah, fair enough - it's that GCC now figures the possibly out-of-bounds access. But yes, the diagnostic itself needs improvement. With C++23 you could try using [[assume]] to preserve the assertion.=