https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98491
--- Comment #1 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
It can be reproduced with a cross build on x86_64-linux, with asan:
$ ../gcc/configure --target=mips64el-unknown-linux-gnuabi64 --with-abi=64
--enable-languages=c,c++ --with-system-zlib
(build log skipped)
$ ASAN_OPTIONS=detect_leaks=0:use_odr_indicator=1 make all-gcc
{C,CXX,LD}FLAGS="-O0 -g3 -ggdb -fsanitize=address -static-libasan" -j 4
(build log skipped)
$ gcc/cc1 ~/bug.c -nostdinc -mmsa
f
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> {heap 0 } <visibility> {heap 0 } <build_ssa_passes> {heap 0
} <opt_local_passes> {heap 0 } <remove_symbols> {heap 0 } <targetclone> {heap 0
} <free-fnsummary> {heap 0 }Streaming LTO
<whole-program> {heap 0 } <fnsummary> {heap 0 } <inline> {heap 0 } <modref>
{heap 0 } <free-fnsummary> {heap 0 } <single-use> {heap 0 } <comdats> {heap 0
}Assembling functions:
f=================================================================
==257274==ERROR: AddressSanitizer: global-buffer-overflow on address
0x00000521e70a at pc 0x000002c535c1 bp 0x7ffc1ac50930 sp 0x7ffc1ac50928
READ of size 2 at 0x00000521e70a thread T0
#0 0x2c535c0 in mode_to_bytes(machine_mode) ../../gcc/gcc/machmode.h:550
#1 0x2c535c0 in mips_symbol_insns ../../gcc/gcc/config/mips/mips.c:2384
#2 0x2c591fc in mips_const_insns(rtx_def*)
../../gcc/gcc/config/mips/mips.c:2895
(more asan output skipped)