From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 03D61385841D; Thu, 30 Mar 2023 13:23:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03D61385841D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680182594; bh=K7irTqNFo35+KF49dtYl/eg3gimX4L9hzmgctrrI3lQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hmQSFrhHI2gp85X82g4Vj/lna5CkzrbEDa5//dj1NXvDG8O+A7UX3BvmjqmWPvpn+ kRWxhuohio9cJxZ4j1fEc6VepOhc1Opi4XxasqhrL9HHIZAQJSAfhg0vF29ok9oNw2 LZk/SCyNdgxuj9zcTXkxDcRI2czkRuYy4dzhpggM= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/85563] [10/11/12/13 regression] -Wmaybe-uninitialized false alarm regression with __builtin_unreachable and GCC 8 Date: Thu, 30 Mar 2023 13:23:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 8.0.1 X-Bugzilla-Keywords: deferred, diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D85563 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com, | |rguenth at gcc dot gnu.org Last reconfirmed|2021-04-15 00:00:00 |2023-3-30 --- Comment #23 from Richard Biener --- Re-confirmed. On the testcase in comment#6 we have before EVRP : Vframe_list.0_1 =3D Vframe_list; a.1_17 =3D (long int) Vframe_list.0_1; _15 =3D (unsigned int) a.1_17; _13 =3D _15 & 7; _10 =3D _13 =3D=3D 3; if (_13 !=3D 3) goto ; [INV] else goto ; [INV] : __builtin_unreachable (); : # frame1_6 =3D PHI # tail_7 =3D PHI a.1_19 =3D (long int) tail_7; _20 =3D (unsigned int) a.1_19; _21 =3D _20 & 7; _22 =3D _21 =3D=3D 3; if (_21 =3D=3D 3) goto ; [INV] else goto ; [INV] : _25 =3D tail_7 + 18446744073709551613; _26 =3D __builtin_assume_aligned (_25, 8); frame1_16 =3D _26->u.s.car; tail_18 =3D _26->u.s.u.cdr; goto ; [INV] : do_switch_frame (frame1_6); and we fail to realize we are never exiting the loop in the first iteration. The diagnostic happens because we run into loop header copying which then results in a jump around the loop with an obviously uninitialized argument to frame1_6. And that's because we have thrown away the __builtin_unreachable before loop header copying (in VRP1, after the first threadfull). Re-ordering CH before VRP fails to optimize even when I also put a copyprop between CH and VRP. We then see [local count: 118111600]: # PT =3D nonlocal escaped null Vframe_list.0_1 =3D Vframe_list; a.1_12 =3D (long int) Vframe_list.0_1; _10 =3D (unsigned int) a.1_12; # RANGE [irange] Lisp_Type [0, 7] NONZERO 0x7 _8 =3D _10 & 7; if (_8 !=3D 3) goto ; [0.00%] else goto ; [100.00%] [count: 0]: __builtin_unreachable (); [local count: 118111600]: a.1_21 =3D (long int) Vframe_list.0_1; _22 =3D (unsigned int) a.1_21; # RANGE [irange] Lisp_Type [0, 7] NONZERO 0x7 _23 =3D _22 & 7; if (_23 =3D=3D 3) but for some reason VRP doesn't optimize the second compare. We'd probably need to value-number here (loop header copying does, but only parts of the function and not including this leading block). So somewhat of a pass ordering issue. The next CSE is DOM and then PRE.=