From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4950439C3837; Thu, 5 Nov 2020 11:49:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4950439C3837 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97721] [11 Regression] ICE in verify_range, at value-range.cc:361 Date: Thu, 05 Nov 2020 11:49:26 +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: Thu, 05 Nov 2020 11:49:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97721 --- Comment #8 from Aldy Hernandez --- (In reply to Jakub Jelinek from comment #7) > But TREE_OVERFLOW is meaningful during evaluation, e.g. inside of VRP or > when folding some expression. It just doesn't belong into the GIMPLE IL. > So I'd say it would be better for ranger when it sees TREE_OVERFLOW const= ant > somewhere in the IL not to set the range to that constant, but to > drop_tree_overflow of it. That's certainly the easiest path for us. We could drop_overflow in get_tree_range while creating said ranges, and then no other changes to the ranger are needed. However, I wonder if compare_values_warnv is being unnecessarily restrictiv= e.=20 For example, here, we bail on overflow, even though tree_int_cst_compare, through its use of wi::cmps, is perfectly capable of comparing these intege= rs: if (!POINTER_TYPE_P (TREE_TYPE (val1))) { /* We cannot compare overflowed values. */ if (TREE_OVERFLOW (val1) || TREE_OVERFLOW (val2)) return -2; if (TREE_CODE (val1) =3D=3D INTEGER_CST && TREE_CODE (val2) =3D=3D INTEGER_CST) return tree_int_cst_compare (val1, val2); as well as here: if (TREE_CODE (val1) =3D=3D INTEGER_CST && TREE_CODE (val2) =3D=3D INT= EGER_CST) { /* We cannot compare overflowed values. */ if (TREE_OVERFLOW (val1) || TREE_OVERFLOW (val2)) return -2; return tree_int_cst_compare (val1, val2); }=