From patchwork Wed Mar 23 09:33:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 52243 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B4DC93864842 for ; Wed, 23 Mar 2022 09:33:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4DC93864842 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1648028038; bh=1SLm/e+RSw+5yPWFJzr9+J0KBKMbcfTRlf+xARvu1Sw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=PDeMkvbmlcI40scK3IeRQJYLg/aIrv+kiGHj4jU0TF9winNltlColzZrR0BhACH2T l+xu2B9Enr/zZHy/FIHpPtoArhtalfgTJpPg2r4sVGTtPXtGKw8qKmyHPQAAdwDf9v uASXqMgy3jOIMa67Gwf/hfQfOOX5TndsdncQfArk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id CDA4C3858427 for ; Wed, 23 Mar 2022 09:33:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CDA4C3858427 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22N5jZXj013651; Wed, 23 Mar 2022 09:33:30 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3eysp8g7gt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Mar 2022 09:33:30 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22N91Nhu037037; Wed, 23 Mar 2022 09:33:29 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 3eysp8g7gc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Mar 2022 09:33:29 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22N9UJMU012848; Wed, 23 Mar 2022 09:33:27 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma05fra.de.ibm.com with ESMTP id 3ew6t9f13r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Mar 2022 09:33:27 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22N9XPmm43123076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Mar 2022 09:33:25 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AF9852051; Wed, 23 Mar 2022 09:33:25 +0000 (GMT) Received: from [9.197.236.227] (unknown [9.197.236.227]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 16D535204E; Wed, 23 Mar 2022 09:33:22 +0000 (GMT) Message-ID: <83ee4de4-abe5-7f50-3cb6-be86d304c507@linux.ibm.com> Date: Wed, 23 Mar 2022 17:33:21 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: GCC Patches Subject: [PATCH] rs6000: Skip overload instances with NULL fntype [PR104967] X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: usiWjOd49p4_pUaQau_73cp55cr1EqVY X-Proofpoint-GUID: BGtugciAm87anpBBe8BKV0AD-sHVgb8g X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-23_05,2022-03-22_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 adultscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203230055 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Peter Bergner , David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, As shown in PR104967, for some overload built-in function instance, if it requires a date type which isn't defined on the target, its fntype would be initialized as NULL. This patch is to consider this possibility in function find_instance to avoid ICE. Bootstrapped and regtested on powerpc64-linux-gnu P8 and powerpc64le-linux-gnu P9 and P10. Is it ok for trunk? BR, Kewen PR target/104967 gcc/ChangeLog: * config/rs6000/rs6000-c.cc (find_instance): Skip instances with null function types. --- gcc/config/rs6000/rs6000-c.cc | 4 ++++ 1 file changed, 4 insertions(+) -- 2.25.1 diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc index 15251efc209..b0f9fce4b54 100644 --- a/gcc/config/rs6000/rs6000-c.cc +++ b/gcc/config/rs6000/rs6000-c.cc @@ -1678,6 +1678,10 @@ find_instance (bool *unsupported_builtin, ovlddata **instance, ovlddata *inst = *instance; gcc_assert (inst != NULL); + /* It is possible for an instance to require a data type that isn't + defined on this target, in which case inst->fntype will be NULL. */ + if (!inst->fntype) + return error_mark_node; tree fntype = rs6000_builtin_info[inst->bifid].fntype; tree parmtype0 = TREE_VALUE (TYPE_ARG_TYPES (fntype)); tree parmtype1 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (fntype)));