public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7555] mips: avoid signed overflow in LUI_OPERAND [PR104842] Date: Wed, 9 Mar 2022 03:21:31 +0000 (GMT) [thread overview] Message-ID: <20220309032131.632333858C60@sourceware.org> (raw) 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. */
reply other threads:[~2022-03-09 3:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220309032131.632333858C60@sourceware.org \ --to=xry111@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).