From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BE2B0385E00A; Tue, 30 Aug 2022 09:40:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE2B0385E00A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661852438; bh=hZLUE36YuIGpLjd1dR65KQHi5xOoxRsyVtY4fiYl8+8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wYEkoI1v4krZQ5jLD64qDpLJrYaSK1QNr4yDe0l/X2RPnm6xT/4oGx9vIkvYAKSHR ESVzSzhtiCY3OcywFqZ3uOQiaGnRQHspf3i0EBKkVqVbHizUveTtZ19lFtV08EWye0 RqsTtBYpsbRjpwU4xrqNd8BLnM3wrG8vLgdLneCQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/67196] [10/11/12/13 Regression] loop-induced false positive from -Wmaybe-uninitialized Date: Tue, 30 Aug 2022 09:40:38 +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.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D67196 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org --- Comment #7 from Richard Biener --- The issue is that the code supposed to deal with this, uninit_analysis::overlap, does not handle the case of chained PHIs very well, that is, [local count: 955630225]: # num_captions_in_row_5 =3D PHI # first_caption_7 =3D PHI # first_caption_idx_9 =3D PHI i_19 =3D i_31 + 1; if (n_16(D) !=3D i_19) goto ; [89.00%] else goto ; [11.00%] ... [local count: 105119324]: _2 =3D first_caption_7 !=3D 0; _3 =3D num_captions_in_row_5 =3D=3D 1; _4 =3D _2 & _3; if (_4 !=3D 0) goto ; [38.20%] else goto ; [61.80%] ... [local count: 118111600]: # _12 =3D PHI return _12; the code searchess for a PHI definition of num_captions_in_row_5 in the same block as the _12 =3D PHI <>, not realizing that uninit analysis also includes edges from the _9 =3D PHI <> in BB5 where the definition ultimatively resides. Then there's the issue that use predicates are not yet normalized at this point so there's still the _4 !=3D 0 test instead of the two ANDed ones. With both fixed the diagnostic is gone.=