RFR: 8328934: Assert that ABS input and output are legal [v2]

Andrew Haley aph at openjdk.org
Fri Apr 12 09:11:47 UTC 2024


On Fri, 12 Apr 2024 08:40:54 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> This should protect us from future accidents around `abs` misuse. We have fixed a few separately. I plan to use this as the litmus test in update releases to detect missing backports for actual fixes. I am running more tests to see if we have any other sightings in current codebase, but this can be reviewed for sanity meanwhile.
>> 
>> Additional testing:
>>  - [x] MacOS AArch64 server fastdebug build passes
>>  - [ ] Linux x86_64 server fastdebug, `all`
>>  - [ ] Linux x86_64 server fastdebug, 100K Fuzzer tests
>>  - [ ] Linux x86_64 server fastdebug, Maven CTW
>>  - [ ] Linux AArch64 server fastdebug, `all`
>
> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Need explicit include as well

src/hotspot/share/utilities/globalDefinitions.hpp line 1110:

> 1108: 
> 1109: template<class T> inline T ABS(T x)                 {
> 1110:   assert(x != std::numeric_limits<T>::min(), "ABS: argument should not allow overflow");

Shouldn't this check for an integral type? This code makes no sense for floating-point types.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18751#discussion_r1562275062


More information about the hotspot-dev mailing list