From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 17B9E395305D; Mon, 16 Aug 2021 17:07:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17B9E395305D From: "msebor 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: Mon, 16 Aug 2021 17:07:17 +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: 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: everconfirmed cf_known_to_fail keywords bug_status cc cf_reconfirmed_on 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: Mon, 16 Aug 2021 17:07:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101912 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Known to fail| |10.3.0, 11.2.0, 12.0, | |6.5.0, 7.5.0, 8.5.0, 9.3.0 Keywords| |diagnostic Status|UNCONFIRMED |NEW CC| |msebor at gcc dot gnu.org Last reconfirmed| |2021-08-16 --- Comment #1 from Martin Sebor --- Confirmed, not a regression. The warning pass considers only one condition= : n > 0. It doesn't consider the conjunction of that condition with those impl= ied by not using the other unintialized PHI operand and that the use is unreach= able otherwise (i.e., that !(corr =3D=3D 1 && leapcnt !=3D 0 && prevcorr - 1 > 1= && n !=3D leapcnt) cannot be true at the point of the use). The logic seem too complicated to me to figure it out but I could be missing something. int tzloadbody () { int corr; int leapcnt; int prevcorr; int n; _Bool _1; _Bool _2; _Bool _5; unsigned int _6; int _8; unsigned int _9; _Bool _21; _Bool _27; [local count: 95397018]: # .MEM_12 =3D VDEF <.MEM_11(D)> n_13 =3D getint (); if (n_13 > 0) goto ; [96.34%] >>> if n > 0... else goto ; [3.66%] [local count: 91905487]: <<< ...prevcorr_14(D)(7) uninitialized here [local count: 1034442874]: <<< if n > 0 && !(c= orr =3D=3D 1 && leapcnt !=3D 0 && prevcorr - 1 > 1 && n !=3D leapcnt) # prevcorr_18 =3D PHI <<<=20 # leapcnt_23 =3D PHI # .MEM_20 =3D PHI <.MEM_15(8), .MEM_12(7)> # .MEM_15 =3D VDEF <.MEM_20> corr_16 =3D getint (); if (corr_16 <=3D 0) goto ; [3.66%] else goto ; [96.34%] [local count: 996582264]: _1 =3D corr_16 =3D=3D 1; _2 =3D leapcnt_23 !=3D 0; _9 =3D (unsigned int) prevcorr_18; <<< -Wmaybe-uninitialized _6 =3D _9 + 4294967295; _5 =3D _6 > 1; _21 =3D _1 & _2; _27 =3D _5 & _21; if (_27 !=3D 0) goto ; [21.78%] else goto ; [78.22%] >>> corr =3D=3D 1 && leapcnt !=3D 0 && prevcorr - 1 > 1 [local count: 217055616]: goto ; [100.00%] [local count: 978344809]: leapcnt_17 =3D leapcnt_23 + 1; if (n_13 !=3D leapcnt_17) goto ; [96.34%] >>> corr =3D=3D 1 && leapcnt !=3D 0 && prevcorr - 1 > 1 && n !=3D leapcnt else goto ; [3.66%] [local count: 35807421]: goto ; [100.00%] [local count: 942537388]: goto ; [100.00%] >>> corr =3D=3D 1 && leapcnt !=3D 0 && prevcorr - 1 > 1 && n !=3D leapcnt [local count: 3491531]: [local count: 95397019]: # _8 =3D PHI <0(9), n_13(12), -1(11), -1(10)> # .MEM_10 =3D PHI <.MEM_12(9), .MEM_15(12), .MEM_15(11), .MEM_15(10)> # VUSE <.MEM_10> return _8; }=