RFR: 8365163: [ubsan] left-shift issue in globalDefinitions.hpp [v6]
Stefan Karlsson
stefank at openjdk.org
Wed Aug 27 14:45:44 UTC 2025
On Wed, 27 Aug 2025 08:24:59 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> There was a left-shift of negative value UB in `set_high` function where the high value sign bit is on and is left-shifted 32 bits to put it in high word of the destination address.
>> To address it, first the left 32 bits of the provided `high` arg is cleared and then left-shifted 32 bits.
>>
>> 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:
>
> used CONST64 for all 64-bits const terms.
test/hotspot/gtest/utilities/test_globalDefinitions.cpp line 306:
> 304: EXPECT_EQ(val, CONST64(0x00000000000000FF));
> 305:
> 306: val = jlong_from(0xFFFFFFFF, 0);
Note that this passes the unsigned int value of 0xFFFFFFFF when the expected type is signed int (jint). If you run with -Wsign-conversion I think you will get a warning. Do we care about that here?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26809#discussion_r2304170713
More information about the hotspot-dev
mailing list