aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@mengyan1223.wang>2021-02-17 11:57:13 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2021-02-17 11:57:13 +0000
commit06505e701dcfdb1b9855601d6cf0aa1caea62975 (patch)
treea6c1d2b7c0afff9075d4791ee2e20856d936239d /gcc/config/mips
parent78a6d0e30d7950216dc0c5be5d65d0cbed13924c (diff)
downloadgcc-06505e701dcfdb1b9855601d6cf0aa1caea62975.zip
gcc-06505e701dcfdb1b9855601d6cf0aa1caea62975.tar.gz
gcc-06505e701dcfdb1b9855601d6cf0aa1caea62975.tar.bz2
mips: Avoid out-of-bounds access in mips_symbol_insns [PR98491]
An invalid use of MSA_SUPPORTED_MODE_P was causing an ICE on mips64el with -mmsa. The detailed analysis is posted on bugzilla. gcc/ChangeLog: 2021-02-17 Xi Ruoyao <xry111@mengyan1223.wang> PR target/98491 * config/mips/mips.c (mips_symbol_insns): Do not use MSA_SUPPORTED_MODE_P if mode is MAX_MACHINE_MODE.
Diffstat (limited to 'gcc/config/mips')
-rw-r--r--gcc/config/mips/mips.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index ebb04b7..8bd2d29 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -2381,7 +2381,7 @@ mips_symbol_insns (enum mips_symbol_type type, machine_mode mode)
{
/* MSA LD.* and ST.* cannot support loading symbols via an immediate
operand. */
- if (MSA_SUPPORTED_MODE_P (mode))
+ if (mode != MAX_MACHINE_MODE && MSA_SUPPORTED_MODE_P (mode))
return 0;
return mips_symbol_insns_1 (type, mode) * (TARGET_MIPS16 ? 2 : 1);