From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 92D743858291; Tue, 13 Sep 2022 20:51:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92D743858291 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663102271; bh=DNcd79m7bRyl+t4e4Lk+w/ac7myOx3DLfys0G5uI0Ow=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xTv6c68tZvl46LVcltcd7hp57KlDqRw31pXFggD4Piti9h+X0ygea6vIgWRaQHMAJ 3rsdalR7COQcSNbdgs8n97XdwT2dt0sdjR3Df7t7I7nGeSYEE5k5X8fESE8ATe45PS p0ARIZgET2FPkvS+x4IGHHDFs+APjFJyG4H0SCa8= From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106936] [13 Regression] ICE in get_value_range, at value-query.cc:170 since r13-1815-g8b8103dcd2624936 Date: Tue, 13 Sep 2022 20:51: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: 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: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106936 --- Comment #2 from Aldy Hernandez --- This assert was put here to make sure that the legacy get_value_range() was= n't being called on stuff that legacy couldn't handle (floats, etc), because the result would ultimately be copied into a value_range_equiv. In this case, simplify_casted_cond() is calling it on an offset_type which isn't either an integer nor a pointer, so the assert is failing. However, range_of_expr happily punted on it because it couldn't handle it, so we're = just returning VARYING. As value_range_equiv can store VARYING types of anything (including types it can't handle), this is fine. I think the easiest thing to do is remove the assert. If someone from the = non legacy world tries to get a non integer/pointer range here, it's going to b= low up anyhow because the temporary in get_value_range is int_range_max. Anywho. This should do the trick. I'm in transit to Cauldron. Could some= one test and push this? I'd hate to leave what looks like an ICE on valid code open. diff --git a/gcc/value-query.cc b/gcc/value-query.cc index 06ad5fe9708..0bdd670982b 100644 --- a/gcc/value-query.cc +++ b/gcc/value-query.cc @@ -167,7 +167,6 @@ range_query::free_value_range_equiv (value_range_equiv = *v) const class value_range_equiv * range_query::get_value_range (const_tree expr, gimple *stmt) { - gcc_checking_assert (value_range_equiv::supports_p (TREE_TYPE (expr))); int_range_max r; if (range_of_expr (r, const_cast (expr), stmt)) return new (equiv_alloc->allocate ()) value_range_equiv (r);=