From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8C45F384B806; Thu, 15 Apr 2021 22:55:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C45F384B806 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/90844] missing -Wmaybe-uninitialized with -flto and optimization Date: Thu, 15 Apr 2021 22:55:05 +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: unknown 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: cc short_desc cf_reconfirmed_on cf_known_to_fail 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: Thu, 15 Apr 2021 22:55:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D90844 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org Summary|Another case of missing use |missing |of uninitialized variable |-Wmaybe-uninitialized with |warning (inlining, CCP) |-flto and optimization Last reconfirmed|2019-06-12 00:00:00 |2021-4-15 Known to fail| |10.2.0, 11.0, 8.3.0, 9.3.0 --- Comment #3 from Martin Sebor --- The late uninit pass doesn't run with -flto; all that runs is the early uninitialized pass and it disables the "conditional" -Wmaybe-uninitialized = when optimization is enabled: static unsigned int execute_early_warn_uninitialized (void) { /* Currently, this pass runs always but execute_late_warn_uninitialized only runs with optimization. With optimization we want to warn about possible uninitialized as late as possible, thus don't do it here. However, without optimization we need to warn here about "may be uninitialized". */ calculate_dominance_info (CDI_POST_DOMINATORS); warn_uninitialized_vars (/*warn_maybe_uninitialized=3D*/!optimize); ^^^^^^^^^ Changing that like so lets the warning do its thing even with -flto: @@ -3086,7 +3079,8 @@ execute_early_warn_uninitialized (void) optimization we need to warn here about "may be uninitialized". */ calculate_dominance_info (CDI_POST_DOMINATORS); - warn_uninitialized_vars (/*warn_maybe_uninitialized=3D*/!optimize); + bool wmaybe_uninit =3D !optimize || flag_lto; + warn_uninitialized_vars (wmaybe_uninit); /* Post-dominator information cannot be reliably updated. Free it after the use. */=