From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DB04C385842B; Wed, 27 Apr 2022 10:17:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB04C385842B From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/105346] [11/12 Regression] -Wno-free-nonheap-object false positive (on Bison-generated grammar code) Date: Wed, 27 Apr 2022 10:17:38 +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.2.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: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 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: Wed, 27 Apr 2022 10:17:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105346 --- Comment #17 from Richard Biener --- A possible fix would be to not run the late checks when not optimizing - in fact the IL for the late and early pass are the same at -O0 so the reason for postponing them isn't there. The only difference is inlining of always-inl= ine functions where one could argue we should do most -O0 diagnostics at that state anyway. Like with the following. Alternatively at -O0 the very first pass instance could do all checking but within a similar construct as the immediately preceeding early -Wuninitialized. diff --git a/gcc/passes.def b/gcc/passes.def index 375d3d62d51..0442b85ee1b 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -402,6 +402,7 @@ along with GCC; see the file COPYING3. If not see number of false positives from it. */ NEXT_PASS (pass_split_crit_edges); NEXT_PASS (pass_late_warn_uninitialized); + NEXT_PASS (pass_warn_access, /*early=3D*/false); /* uncprop replaces constants by SSA names. This makes analysis har= der and thus it should be run last. */ NEXT_PASS (pass_uncprop); @@ -428,7 +429,6 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_gimple_isel); NEXT_PASS (pass_harden_conditional_branches); NEXT_PASS (pass_harden_compares); - NEXT_PASS (pass_warn_access, /*early=3D*/false); NEXT_PASS (pass_cleanup_cfg_post_optimizing); NEXT_PASS (pass_warn_function_noreturn);=