public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7555] mips: avoid signed overflow in LUI_OPERAND [PR104842]
@ 2022-03-09  3:21 Xi Ruoyao
  0 siblings, 0 replies; only message in thread
From: Xi Ruoyao @ 2022-03-09  3:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2ab70a4a5c2d5a9ffb923f13b1c3b938c60dd0f0

commit r12-7555-g2ab70a4a5c2d5a9ffb923f13b1c3b938c60dd0f0
Author: Xi Ruoyao <xry111@mengyan1223.wang>
Date:   Wed Mar 9 01:08:58 2022 +0800

    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:
---
 gcc/config/mips/mips.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-09  3:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  3:21 [gcc r12-7555] mips: avoid signed overflow in LUI_OPERAND [PR104842] Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).