From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3824B3858D33; Thu, 4 May 2023 11:37:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3824B3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683200274; bh=rY+H2ep/WY3rY3X5vAh2iTCQrdvP8S7wQBr6EoDDWx8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sxQn6Cnq9GWofx3IAAsGqA3NDyin1piGhB98DYvuJcZ7H3qiJ9fHCdRy7EV59/cvd xo99tWfg/d8CAHM+rlJgues8Chw2PneJfo0SRH1z6SKorhb4or0CgZL9cIBaqduR0q ATCXM5X7/JuZj130d5iQVCB9fWTOXhAMRcftAv/s= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109717] -Warray-bound error with gnu++20 and fmt library Date: Thu, 04 May 2023 11:37:53 +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.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109717 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmalcolm at gcc dot gnu.org --- Comment #8 from Richard Biener --- (In reply to Jonathan Wakely from comment #7) > And requiring every library to annotate every assumption causes regressio= ns > like PR 109703, where the cure is worse than the disease. >=20 > A wrong-code bug is worse than a false positive warning, but the warnings > are forcing people to modify correct code. I agree, but then I do not see how to reliably diagnose real problems. The= re is no way GCC can prove a line of code will be executed (the whole function could be dead). And given C++ abstraction and high branch density the amount of IL not under conditional execution in a function is about zero. Annotating the library also gives way to better optimization. It might be an interesting experiment to use coverage data to prune diagnostics on locations that are not covered. All our late diagnostics could be put into a separate -Wall. That of course requires we can somehow reliably get coverage of a program and also distinguish the various copies of the same location passes like jump threading create ... Might be also interesting to steer static analysis to those "interesting" paths. One requirement would probably be that we put all late diagnostics on a common point in the pass pipeline, otherwise adding discriminators for all "variants" of the IL we run into makes the coverage data explode (much easier for the analyzer here).=