From: Guo Jie Date: Thu, 23 Nov 2023 03:05:56 +0000 (+0800) Subject: LoongArch: Fix runtime error in a gcc build with --with-build-config=bootstrap-ubsan X-Git-Tag: basepoints/gcc-15~4275 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b9d0e8cf482287b6c37b5a268d0eb2d0a964561;p=thirdparty%2Fgcc.git LoongArch: Fix runtime error in a gcc build with --with-build-config=bootstrap-ubsan gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_split_plus_constant): avoid left shift of negative value -0x8000. --- diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index c95fc83362e9..d3896d72bc2e 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -4269,7 +4269,7 @@ loongarch_split_plus_constant (rtx *op, machine_mode mode) else if (loongarch_addu16i_imm12_operand_p (v, mode)) a = (v & ~HWIT_UC_0xFFF) + ((v & 0x800) << 1); else if (mode == DImode && DUAL_ADDU16I_OPERAND (v)) - a = (v > 0 ? 0x7fff : -0x8000) << 16; + a = (v > 0 ? 0x7fff0000 : ~0x7fffffff); else gcc_unreachable ();