From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 235883858C39; Tue, 12 Oct 2021 15:44:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 235883858C39 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102697] [12 Regression] overflow warning missing after -O2 vectorization Date: Tue, 12 Oct 2021 15:44:03 +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 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: short_desc cf_reconfirmed_on everconfirmed bug_status 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, 12 Oct 2021 15:44:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102697 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[Diagnostics] overflow |[12 Regression] overflow |warning missing after O2 |warning missing after -O2 |vectorization. |vectorization Last reconfirmed| |2021-10-12 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #2 from Martin Sebor --- Confirmed as a false negative and a GCC 12 regression. The expected warning is based on the assumption that an unknown offset to a subobject is non-negative. This assumption is supported by the constraint = that pointer arithmetic must be confined to the [sub]object the pointer points t= o.=20 I.e., it's not valid to form a pointer to one subobject by adding an offset= to a pointer to another [sub]object (even within the same object). The same constraint is enforced by -Warray-bounds. The missing -Wstringop-overflow = is due to the hack mentioned in the following discussion: https://gcc.gnu.org/pipermail/gcc-patches/2021-September/580172.html The warning is issued from the strlen pass which runs at -O2 and above. It= 's still issued when -fno-tree-vectorized is specified but should be issued ev= en with vectorization, and ideally at all optimization levels, including -O0.=