From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8CB12383FBA1; Wed, 31 Aug 2022 14:04:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CB12383FBA1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661954652; bh=eZPwYm2Zd4l9FcLHI+CZ9soA81BMsfBOU/+AqafvwXg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=V6fx1yg6Sa+t4QRkNBw5kvTq7+cTCCyKzlI/BgY4Q4LtSDuZbxq0TICrN1YTVESdE N1kSyKGx5jsDUsnz47OO8MG79ySBqz70IHb7vQsoJ42pa5t8aIGWlMpegs2MnLC5nh kDNwagg/Ag/zozAFAEkten9cWxNqQLOBBkYA5gAs= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106155] [12/13 Regression] spurious "may be used uninitialized" warning Date: Wed, 31 Aug 2022 14:04:11 +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: 13.0 X-Bugzilla-Keywords: diagnostic, missed-optimization 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: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status 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=3D106155 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org Status|NEW |ASSIGNED --- Comment #6 from Richard Biener --- The issue here is that we see [local count: 805306369]: # emax_41 =3D PHI # ivtmp.7_44 =3D PHI i_46 =3D (int) ivtmp.7_44; if (i_46 =3D=3D 2) goto ; [12.49%] // init else goto ; [87.51%] ... [local count: 805306369]: fh.1_6 =3D fh; f4 (fh.1_6); e.2_7 =3D e; *e.2_7 =3D 0; f1 (); if (ivtmp.7_44 =3D=3D 2) goto ; [12.49%] // use else goto ; [87.51%] and the predicates i_46 =3D=3D 2 and ivtmp.7_44 =3D=3D 2 do not match up. Oh, and my r13-2149-g200baf7698a100 change made us run into if (dominated_by_p (CDI_POST_DOMINATORS, def_bb, use_bb)) /* The use is not guarded. */ return false; for this use on the loop exit because post-dominance doesn't cover loop exit conditions. I will think about this a bit more. I'll also note it is a missed optimization to not replace the i_46 =3D=3D 2 check. -fno-ivopts makes the warning disappear (when the above is fixed). For some reason we do not optimize the i_46 =3D (int) ivtmp.7_44; if (i_46 =3D=3D 2) stmt, likely because ivtmp is 64bit while i is 32bit and we don't check ivtmps value range here.=