From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E35FF3858408; Tue, 30 Nov 2021 14:09:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E35FF3858408 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/80548] -Wmaybe-uninitialized false positive when an assignment is added Date: Tue, 30 Nov 2021 14:09:52 +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: 6.3.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh 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 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: Tue, 30 Nov 2021 14:09:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D80548 Aldy Hernandez changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org, | |amacleod at redhat dot com, | |law at gcc dot gnu.org --- Comment #3 from Aldy Hernandez --- I think we should start thinking of any Wuninitialized warnings in terms of missed threads, at least initially. Jeff has mentioned this in the past, an I'm slowly being converted. I mean, not that there aren't problems in the uninit code, but we should at least check that there are no missing threads. The problematic read from x is in BB5: [local count: 55807731]: h (x_17, y_2); y_16 =3D g (); goto ; [100.00%] On paths starting on 2->3 x_17 is defined, whereas on paths starting on 2->6 x_17 is undefined: [local count: 59055799]: # x_17 =3D PHI Looking at the last threader (threadfull2) before the uninit pass we see bo= ths paths are registered for threading: [3] Registering jump thread: (3, 6) incoming edge; (6, 7) normal (7, 8) normal (8, 4) normal (4, 5) nocopy;=20 [4] Registering jump thread: (2, 6) incoming edge; (6, 7) normal (7, 8) normal (8, 4) normal (4, 10) nocopy;=20 However, there were no threaded paths in the entire compilation: $ grep thread a.c.338t.statistics=20 $ So sometime between registering the path for threading and the lowlevel BB copier, we dropped the threads. The culprit is duplicate_thread_path in the generic bits: /* We do not handle subloops, i.e. all the blocks must belong to the same loop. */ if (region[i]->loop_father !=3D loop) return false; This is an area I'm unfamiliar with, but it seems we should be able to thre= ad this when loop optimizations are done. And indeed, if we allow this when loop_done, no warning is emitted.=