RFR: 8358957: [ubsan]: The assert in layout_helper_boolean_diffbit() in klass.hpp needs UB to fail [v8]

Kim Barrett kbarrett at openjdk.org
Wed Jan 21 00:36:50 UTC 2026


On Mon, 15 Sep 2025 10:27:41 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   disabling the msvc warning remoeved
>
> src/hotspot/share/oops/klass.hpp line 526:
> 
>> 524:     // So use alternate form of negation to avoid warning.
>> 525:     uint result = candidates & (~candidates + 1);
>> 526:     return static_cast<int>(result);
> 
> Since this is the implementation I suggested in JBS, I'm going to leave it to others to approve or not.
> Maybe there should be a post-condition check that the result meets the requirements. That's simpler
> than adding a gtest or anything like that.

The asserts that were added since my comment look satisfactory.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27288#discussion_r2710541760


More information about the hotspot-dev mailing list