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

Kim Barrett kbarrett at openjdk.org
Wed Nov 12 04:13:03 UTC 2025


On Tue, 11 Nov 2025 10:13:44 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> Avoid using loop and UB in left-shift operation as suggested by Kim's comment in the JBS-issue.
>> 
>> Tests:
>>  mach5 tiers 1-5 {macosx-aarch64, linux-x64, windows-x64} x {debug, product}
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Windows warning bypassed

src/hotspot/share/oops/klass.hpp line 515:

> 513: 
> 514:   // VS warns (C4146) about unary minus of unsigned.
> 515:   PRAGMA_DISABLE_MSVC_WARNING(4146)

It seems that some time ago (JDK-8254072) 4146 was disabled for JVM MSVC build:
https://github.com/openjdk/jdk/blame/8531fa146be1da5e96c0f23091882a27c67d7893/make/hotspot/lib/CompileJvm.gmk#L117

So the warning isn't a concern after all. Sorry for the false alarm and
misleading guidance.

This was also not the correct way to introduce the warning suppression had it
been needed, but that's moot.

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

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


More information about the hotspot-dev mailing list