From: Xi Ruoyao Date: Tue, 8 Mar 2022 17:08:58 +0000 (+0800) Subject: mips: avoid signed overflow in LUI_OPERAND [PR104842] X-Git-Tag: upstream/12.2.0~1142 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ab70a4a5c2d5a9ffb923f13b1c3b938c60dd0f0;p=platform%2Fupstream%2Fgcc.git mips: avoid signed overflow in LUI_OPERAND [PR104842] gcc/ PR target/104842 * config/mips/mips.h (LUI_OPERAND): Cast the input to an unsigned value before adding an offset. --- diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index bf5c1d5a709..0029864fdcd 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -2309,7 +2309,7 @@ enum reg_class #define LUI_OPERAND(VALUE) \ (((VALUE) | 0x7fff0000) == 0x7fff0000 \ - || ((VALUE) | 0x7fff0000) + 0x10000 == 0) + || ((unsigned HOST_WIDE_INT) (VALUE) | 0x7fff0000) + 0x10000 == 0) /* Return a value X with the low 16 bits clear, and such that VALUE - X is a signed 16-bit value. */