From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 641E53858D28; Fri, 4 Feb 2022 08:24:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 641E53858D28 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104373] [12 regression] bogus -Wmaybe-uninitialized warning with array new Date: Fri, 04 Feb 2022 08:24:43 +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: 12.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: 12.0 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: Fri, 04 Feb 2022 08:24:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104373 --- Comment #2 from Richard Biener --- When not optimizing we intentionally warn about only conditionally executed cases early - and not optimizing means we do not detect trivially unreachab= le paths like this. I don't know whether we have good enough infrastructure now to have a way to determine that after discovering a possible uninit but it would be possible to fix this particular instance by walking BBs in RPO order and keeping a very simple const/copy lattice to avoid traversing along unreachable edges. The non-iterative VN algorithm does this for example. In theory you could also use that, you can specify eliminate =3D=3D false so it doesn't modify = the IL and if you then add a callback per reachable stmt (or BB) you'd get even more fancy cases handled (at compile-time cost of course). The other early diagnostic passes might also benefit from that. Alternativ= ely you could just initialize EDGE_EXECUTABLE/BB_REACHABLE from it before the early diagnostic passes and then rely on that during those. Note it's all non-IPA though and the early diagnostic passes should maybe run from the local optimization pipeline, before early_inline (maybe after inlining always-inline though?), so they can benefit from local IPA analysis done on called functions.=