From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 37E353857809 for ; Mon, 25 Jul 2022 15:30:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 37E353857809 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-YqXGn_aiOYiK5XvB-zOVfA-1; Mon, 25 Jul 2022 11:30:32 -0400 X-MC-Unique: YqXGn_aiOYiK5XvB-zOVfA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BEF2A2802282 for ; Mon, 25 Jul 2022 15:30:31 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.195.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6478540CFD05; Mon, 25 Jul 2022 15:30:31 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 26PFUT172193032 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 25 Jul 2022 17:30:29 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 26PFUSuv2193031; Mon, 25 Jul 2022 17:30:28 +0200 From: Aldy Hernandez To: GCC patches Subject: [COMMITTED] [PR middle-end/106432] Gracefully handle unsupported type in range_on_edge Date: Mon, 25 Jul 2022 17:30:18 +0200 Message-Id: <20220725153018.2193015-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2022 15:30:35 -0000 A cleaner approach to fix this PR has been suggested by Andrew, which is to just return false on range_on_edge for unsupported range types. Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range.cc (gimple_ranger::range_on_edge): Return false when the result range type is unsupported. --- gcc/gimple-range.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 7ac48303e4e..eb347eee45b 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -201,7 +201,9 @@ bool gimple_ranger::range_on_edge (vrange &r, edge e, tree name) { Value_Range edge_range (TREE_TYPE (name)); - gcc_checking_assert (r.supports_type_p (TREE_TYPE (name))); + + if (!r.supports_type_p (TREE_TYPE (name))) + return false; // Do not process values along abnormal edges. if (e->flags & EDGE_ABNORMAL) -- 2.36.1