diff options
author | Alan Modra <amodra@gmail.com> | 2025-05-21 17:57:04 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2025-05-22 08:42:12 +0930 |
commit | 7d411b8d9b84904d8f9db1d3b17fedeef1757575 (patch) | |
tree | 7383db8e59000692504f0355b2be7ed475d63cd7 | |
parent | 1305119a7ef3d19b7d868093b7b6b6a6c4f21c19 (diff) | |
download | binutils-7d411b8d9b84904d8f9db1d3b17fedeef1757575.zip binutils-7d411b8d9b84904d8f9db1d3b17fedeef1757575.tar.gz binutils-7d411b8d9b84904d8f9db1d3b17fedeef1757575.tar.bz2 |
ubsan: integer overflow in tc-i386.c:offset_in_range
or $9223372036854775808,%eax
runtime error: negation of -9223372036854775808 cannot be represented
in type 'offsetT' (aka 'long'); cast to an unsigned type to negate
this value to itself
* config/tc-i386.c (offset_in_range): Avoid signed overflow.
-rw-r--r-- | gas/config/tc-i386.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 162e28e..25bbc53 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2990,7 +2990,7 @@ offset_in_range (offsetT val, int size) default: abort (); } - if ((val & ~mask) != 0 && (-val & ~mask) != 0) + if ((val & ~mask) != 0 && (-(addressT) val & ~mask) != 0) as_warn (_("0x%" PRIx64 " shortened to 0x%" PRIx64), (uint64_t) val, (uint64_t) (val & mask)); |