RFR: 8324833: Signed integer overflows in ABS [v3]
Dean Long
dlong at openjdk.org
Wed Feb 7 08:56:57 UTC 2024
On Fri, 2 Feb 2024 09:47:28 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> See the details in the bug. I think current `ABS` implementation is beyond repair, and we should just switch to `uabs`.
>>
>> Additional testing:
>> - [x] Linux x86_64 fastdebug, `all` with `-ftrapv` (now fully passes!)
>> - [x] Linux x86_64 fastdebug, `all`
>
> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>
> Touchups
I didn't mean to say ABS() can't be implemented in C++ without UB. But if it returns a negative number, then that seems surprising. For reference, the Linux man page for the abs(3) library call says "Trying to take the absolute value of the most negative integer is not defined."
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17617#issuecomment-1931559874
More information about the graal-dev
mailing list