From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A6CF3858020; Mon, 19 Oct 2020 08:06:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A6CF3858020 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97467] [11 Regression] ICE in verify_range, at value-range.cc:369 (-Os and above) since r11-3685-gfcae5121154d1c33 Date: Mon, 19 Oct 2020 08:06:09 +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.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh 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: 11.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: Mon, 19 Oct 2020 08:06:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97467 --- Comment #2 from Aldy Hernandez --- Ranger can figure out that the RHS operand of a shift is a zero and feeds i= t to operator_lshift::op1_range, which then uses it to create a swapped [1,0] ra= nge. Testing the following patch: diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 0efa00186e8..30d2a4d3987 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -1579,6 +1579,11 @@ operator_lshift::op1_range (irange &r, wide_int shift =3D wi::to_wide (shift_amount); if (wi::lt_p (shift, 0, SIGNED)) return false; + if (shift =3D=3D 0) + { + r =3D lhs; + return true; + } // Work completely in unsigned mode to start. tree utype =3D type;=