RFR: 8324833: Signed integer overflows in ABS [v5]
Dean Long
dlong at openjdk.org
Fri Feb 23 03:27:56 UTC 2024
On Thu, 22 Feb 2024 08:53:24 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:
>
> Fix a place where we cast to jlong after uabs
src/hotspot/share/opto/loopnode.cpp line 805:
> 803: // overflow: max_jint - stride_con max. -1 so there's no need for a
> 804: // loop limit check if the exit test is <= or >=.
> 805: int iters_limit = max_jint - uabs(stride_con) - 1;
It appears iters_limit can become -1 or -2 here, depending on the value of stride_con. See below for the problem.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17617#discussion_r1500178001
More information about the graal-dev
mailing list