public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104842] New: mips: signed overflow in LUI_OPERAND
@ 2022-03-08 16:54 xry111 at mengyan1223 dot wang
2022-03-09 3:21 ` [Bug target/104842] " cvs-commit at gcc dot gnu.org
2022-03-09 3:22 ` xry111 at mengyan1223 dot wang
0 siblings, 2 replies; 3+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-03-08 16:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104842
Bug ID: 104842
Summary: mips: signed overflow in LUI_OPERAND
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: xry111 at mengyan1223 dot wang
Target Milestone: ---
Found this building GCC on mips64el-linux-gnuabi64 with bootstrap-ubsan
(testing a patch enabling ubsan for mips64*-linux-gnu*):
../../gcc/gcc/config/mips/predicates.md:382:11: runtime error: signed integer
overflow: 9223372036854775807 + 65536 cannot be represented in type 'long
int'
That line uses LUI_INT (x), which expands to LUI_OPERAND (INTVAL (x)).
LUI_OPERAND is defined as:
#define LUI_OPERAND(VALUE) \
(((VALUE) | 0x7fff0000) == 0x7fff0000 \
|| ((VALUE) | 0x7fff0000) + 0x10000 == 0)
Obviously this will cause a signed overflow when INTVAL (x) is, for example,
the maximum value of HOST_WIDE_INT.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/104842] mips: signed overflow in LUI_OPERAND
2022-03-08 16:54 [Bug target/104842] New: mips: signed overflow in LUI_OPERAND xry111 at mengyan1223 dot wang
@ 2022-03-09 3:21 ` cvs-commit at gcc dot gnu.org
2022-03-09 3:22 ` xry111 at mengyan1223 dot wang
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-09 3:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104842
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Xi Ruoyao <xry111@gcc.gnu.org>:
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/104842] mips: signed overflow in LUI_OPERAND
2022-03-08 16:54 [Bug target/104842] New: mips: signed overflow in LUI_OPERAND xry111 at mengyan1223 dot wang
2022-03-09 3:21 ` [Bug target/104842] " cvs-commit at gcc dot gnu.org
@ 2022-03-09 3:22 ` xry111 at mengyan1223 dot wang
1 sibling, 0 replies; 3+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-03-09 3:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104842
Xi Ruoyao <xry111 at mengyan1223 dot wang> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
Fixed for trunk.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-09 3:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 16:54 [Bug target/104842] New: mips: signed overflow in LUI_OPERAND xry111 at mengyan1223 dot wang
2022-03-09 3:21 ` [Bug target/104842] " cvs-commit at gcc dot gnu.org
2022-03-09 3:22 ` xry111 at mengyan1223 dot wang
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).