aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips/mips.h
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@mengyan1223.wang>2022-03-09 01:08:58 +0800
committerXi Ruoyao <xry111@mengyan1223.wang>2022-03-09 11:21:08 +0800
commit2ab70a4a5c2d5a9ffb923f13b1c3b938c60dd0f0 (patch)
treec7b4198e25327b37b5285040892d3eec82113ac5 /gcc/config/mips/mips.h
parent17bffa0c9f90df49bde6671816bde04008b6c5af (diff)
downloadgcc-2ab70a4a5c2d5a9ffb923f13b1c3b938c60dd0f0.zip
gcc-2ab70a4a5c2d5a9ffb923f13b1c3b938c60dd0f0.tar.gz
gcc-2ab70a4a5c2d5a9ffb923f13b1c3b938c60dd0f0.tar.bz2
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.
Diffstat (limited to 'gcc/config/mips/mips.h')
-rw-r--r--gcc/config/mips/mips.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index bf5c1d5..0029864 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. */