public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] LoongArch: Avoid RTL flag check failure in loongarch_classify_symbol
@ 2022-08-24 14:03 Xi Ruoyao
  2022-08-24 14:08 ` [PATCH v2 2/2] LoongArch: add model attribute Xi Ruoyao
  2022-08-25  8:29 ` [PATCH 1/2] LoongArch: Avoid RTL flag check failure in loongarch_classify_symbol Lulu Cheng
  0 siblings, 2 replies; 11+ messages in thread
From: Xi Ruoyao @ 2022-08-24 14:03 UTC (permalink / raw)
  To: gcc-patches, Lulu Cheng
  Cc: Chenghua Xu, Youling Tang, Huacai Chen, Jinyang He, Wang Xuerui

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/loongarch.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_mode 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;
 
   if (SYMBOL_REF_TLS_MODEL (x))
     return SYMBOL_TLS;
 
-  if (SYMBOL_REF_P (x)
-      && !loongarch_symbol_binds_local_p (x))
+  if (!loongarch_symbol_binds_local_p (x))
     return SYMBOL_GOT_DISP;
 
   return SYMBOL_PCREL;
-- 
2.37.2



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-08-25 11:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24 14:03 [PATCH 1/2] LoongArch: Avoid RTL flag check failure in loongarch_classify_symbol Xi Ruoyao
2022-08-24 14:08 ` [PATCH v2 2/2] LoongArch: add model attribute Xi Ruoyao
2022-08-24 14:12   ` [PATCH v2 2/2 resend] " Xi Ruoyao
2022-08-25  8:53     ` Lulu Cheng
2022-08-25  8:53       ` Lulu Cheng
2022-08-25  9:12       ` Xi Ruoyao
2022-08-25 11:41         ` Xi Ruoyao
2022-08-25 11:53           ` Lulu Cheng
2022-08-25  8:29 ` [PATCH 1/2] LoongArch: Avoid RTL flag check failure in loongarch_classify_symbol Lulu Cheng
2022-08-25  8:29   ` Lulu Cheng
2022-08-25 10:53   ` Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).