From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D29103857804; Mon, 21 Jun 2021 16:44:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D29103857804 From: "dangelog at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/101134] Bogus -Wstringop-overflow warning about non-existent overflow Date: Mon, 21 Jun 2021 16:44:48 +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: 11.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: dangelog at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WONTFIX 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: 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, 21 Jun 2021 16:44:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101134 --- Comment #2 from Giuseppe D'Angelo --- As I said, > Adding enough __builtin_unreachable() for that condition removes the warn= ings, but it should not be necessary. I disagree with the resolution, though. While I understand that GCC cannot reason globally, the warning message itself is miselading, as it's worded i= n a way that makes the user think that GCC has *conclusevely* proven the existe= nce of a problem, while in fact GCC is wrong. Specifically, this statement: > :75:31: warning: writing 1 byte into a region of size 0 [-Wst= ringop-overflow=3D] At least, I'd like a less strong wording if GCC cannot *prove* this but only estimate it (e.g. "warning: possible string overflow (writing 1 byte...)"). Ideally, even, having two separate warnings or two separate warning levels (overflow proved / overflow just estimated) so one can enable only one of t= he two if needed.=