From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3F2C43952522; Mon, 19 Apr 2021 15:47:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F2C43952522 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100137] [10/11 Regression] -Warray-bounds false positive on varying offset plus negative Date: Mon, 19 Apr 2021 15:47:02 +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: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: msebor at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to 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: Mon, 19 Apr 2021 15:47:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100137 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot g= nu.org --- Comment #3 from Martin Sebor --- The warning bug was introduced in r262893 (GCC 10). A trivial test case is: $ cat a.c && gcc -O2 -S -Wall a.c int f (long i) { const char *p =3D "123"; p +=3D i; return p[-1]; } a.c: In function =E2=80=98f=E2=80=99: a.c:5:11: warning: array subscript -1 is outside array bounds of =E2=80=98c= har[4]=E2=80=99 [-Warray-bounds] 5 | return p[-1]; | ~^~~~ This same thing is handled correctly elsewhere (e.h., -Wstringop_overflow) = so the ideal fix is to replace the warning code with the new pointer_query cla= ss.=