From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DCCA33858D20; Tue, 8 Feb 2022 22:17:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCCA33858D20 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104355] Misleading -Warray-bounds documentation says "always out of bounds" Date: Tue, 08 Feb 2022 22:17:12 +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: 12.0 X-Bugzilla-Keywords: diagnostic, documentation X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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: Tue, 08 Feb 2022 22:17:13 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104355 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #2 from Martin Sebor --- The documentation is also incorrect about the warning being only active with -ftree-vrp. A small subset of -Warray-bounds is issued even without optimization. For example the following warning(s) have been issued since = GCC 4.1:=20 $ cat a.c && gcc -S -Wall a.c int f (void) { return __builtin_strlen ("123" + 5); } a.c: In function =E2=80=98f=E2=80=99: a.c:3:34: warning: offset =E2=80=985=E2=80=99 outside bounds of constant st= ring [-Warray-bounds] 3 | return __builtin_strlen ("123" + 5); | ~~~~~~^~~ a.c:3:10: warning: offset =E2=80=985=E2=80=99 outside bounds of constant st= ring [-Warray-bounds] 3 | return __builtin_strlen ("123" + 5); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~=