From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id A2DB4385C32C for ; Wed, 24 Aug 2022 14:03:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A2DB4385C32C Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1661349816; bh=nWbDk979OMf/7jQSttK9VRf+1HA22i6MrDTOLrc3+nw=; h=Subject:From:To:Cc:Date:From; b=lCyFUZgejWyHWiLgRVKCzUJtRmB6Ya9IBIdF8uSeNKv86J0+nJgqTjk9aQGWMixSt W2hn3RL6r4hUZyItadmJ5wfvMDzf82wo8aXS5NTlW+49nV70C4D4qdfcNc0ToN6T3y IHGYUbs51j2q6CtcKvD/Jr1oklS7LF5bjmh0uZvE= Received: from [IPv6:240e:358:113a:9c00:dc73:854d:832e:3] (unknown [IPv6:240e:358:113a:9c00:dc73:854d:832e:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384)) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 5FF4C6699F; Wed, 24 Aug 2022 10:03:31 -0400 (EDT) Message-ID: Subject: [PATCH 1/2] LoongArch: Avoid RTL flag check failure in loongarch_classify_symbol From: Xi Ruoyao To: gcc-patches@gcc.gnu.org, Lulu Cheng Cc: Chenghua Xu , Youling Tang , Huacai Chen , Jinyang He , Wang Xuerui Date: Wed, 24 Aug 2022 22:03:26 +0800 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD,FROM_SUSPICIOUS_NTLD_FP,GIT_PATCH_0,KAM_STOCKGEN,LIKELY_SPAM_FROM,PDS_OTHER_BAD_TLD,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: SYMBOL_REF_TLS_MODEL invokes SYMBOL_REF_FLAGS, and SYMBOL_REF_FLAGS invokes RTL_FLAG_CHECK1 and aborts when RTL code is not SYMBOL_REF. r13-1833 removed "gcc_assert (SYMBOL_REF_P (x))" before invoking "SYMBOL_REF_TLS_MODEL (x)", indicating that it's now possible that "x" is not a SYMBOL_REF. So we need to check if "x" is SYMBOL_REF first. This fixes a test failure happening with r13-2173: pr106096.C:26:1: internal compiler error: RTL flag check: SYMBOL_REF_FLAGS used with unexpected rtx code 'const' in loongarch_classify_symbol gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_classify_symbol): Return early if the rtx is not SYMBOL_REF. --- gcc/config/loongarch/loongarch.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loong= arch.cc index 16fd4acc970..41d9cca6d31 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -1633,14 +1633,13 @@ loongarch_rtx_constant_in_small_data_p (machine_mod= e mode) static enum loongarch_symbol_type loongarch_classify_symbol (const_rtx x) { - if (LABEL_REF_P (x)) + if (!SYMBOL_REF_P (x)) return SYMBOL_PCREL; =20 if (SYMBOL_REF_TLS_MODEL (x)) return SYMBOL_TLS; =20 - if (SYMBOL_REF_P (x) - && !loongarch_symbol_binds_local_p (x)) + if (!loongarch_symbol_binds_local_p (x)) return SYMBOL_GOT_DISP; =20 return SYMBOL_PCREL; --=20 2.37.2