From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A9AE23858039; Wed, 2 Feb 2022 10:37:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9AE23858039 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104334] [12 Regression] Ranger/dom miscompilation Date: Wed, 02 Feb 2022 10:37:15 +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: 12.0 X-Bugzilla-Keywords: lto, needs-bisection, wrong-code X-Bugzilla-Severity: blocker X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Wed, 02 Feb 2022 10:37:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104334 --- Comment #6 from Jakub Jelinek --- So, in the debugger the difference is in the range_operator::wi_fold_in_par= ts function (with: enum class A { A0, A1, A2, A3 }; int x; void baz (); struct B { unsigned b : 2; A foo () const { return static_cast (b); } void bar (); }; void B::bar () { if (foo () =3D=3D A::A2 || foo () =3D=3D A::A3) baz (); } the first one). type is unsigned:2, lh_lb 0, lh_ub -1 (aka 3), rh_lb and rh_ub -2 (aka 2). lh_range is -1 (aka 3), rh_range is 0, ov_{l,r}h is OVF_NONE. In the non-LTO case, we do wi_fold on line 176 171 // Otherise check for 2, 3, or 4 values in the LH range and split them up. 172 // The RH side has been checked, so no recursion needed. 173 else if (wi::gt_p (lh_range, 0, sign) && wi::lt_p (lh_range, 4, s= ign) 174 && ov_lh =3D=3D wi::OVF_NONE) 175 { 176 wi_fold (r, type, lh_lb, lh_lb, rh_lb, rh_ub); while in the LTO case on line 192. The wi::lt_p (rh_range, 4, sign) and wi::lt_p (lh_range, 4, sign) calls look highly suspicious, 4 is not representable in unsigned:2.=