From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A0ED73858408; Tue, 30 Nov 2021 15:41:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0ED73858408 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101912] -Wmaybe-uninitialized false alarm in tzdb localtime.c Date: Tue, 30 Nov 2021 15:41:07 +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: 11.2.1 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 15:41:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101912 Aldy Hernandez changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org, | |rguenth at gcc dot gnu.org --- Comment #2 from Aldy Hernandez --- ISTM that the warning is correct, given the IL the uninit pass gets. On the 7->3 entry to the loop prevcorr_23 can be undefined, and it is read = in BB4 with no guard whatsoever: [local count: 85931698]: [local count: 1034442873]: # prevcorr_23 =3D PHI # leapcnt_24 =3D PHI corr_14 =3D getint (); if (corr_14 <=3D 0) goto ; [3.66%] else goto ; [96.34%] [local count: 37860610]: goto ; [100.00%] [local count: 996582262]: _1 =3D corr_14 =3D=3D 1; _2 =3D leapcnt_24 !=3D 0; _7 =3D (unsigned int) prevcorr_23; _5 =3D _7 + 4294967295; _4 =3D _5 > 1; _22 =3D _1 & _2; _18 =3D _4 & _22; if (_18 !=3D 0) goto ; [1.21%] else goto ; [98.79%] However, in the original source we shouldn't read from prevcorr if leapcnt = =3D=3D 0, which is the case on entry to the loop: && !(leapcnt =3D=3D 0 || (prevcorr < corr ? corr =3D=3D prevcorr + 1 : (corr =3D=3D prevcorr || corr =3D=3D prevcorr - 1))))) It looks like we lost the leapcnt gate protecting the prevcorr_23 read. Unless I'm missing some subtle language thinggie, we loose the gate in the ifcombine pass. Before it, the read from prevcorr was protected by: [local count: 996582262]: _1 =3D corr_14 =3D=3D 1; _2 =3D leapcnt_5 !=3D 0; _3 =3D _1 & _2; if (_3 !=3D 0) goto ; [50.00%] else goto ; [50.00%] and after ifcombine we have: [local count: 996582262]: _1 =3D corr_14 =3D=3D 1; _2 =3D leapcnt_5 !=3D 0; _3 =3D _1 & _2; _19 =3D prevcorr_4 !=3D 1; _16 =3D _3 & _19; _21 =3D prevcorr_4 !=3D 2; _18 =3D _16 & _21; if (_18 !=3D 0) goto ; [1.21%] else goto ; [98.79%] Unfortunately, adding -fdisable-tree-ifcombine doesn't make the warning go away, but at least the IL by the uninit pass seems correct.=