RFR: 8365163: [ubsan] left-shift issue in globalDefinitions.hpp [v5]
Dean Long
dlong at openjdk.org
Tue Aug 26 19:17:35 UTC 2025
On Tue, 26 Aug 2025 13:51:53 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:
>
> CONST64 vs explicit casting.
BTW, gcc x64 generates slightly better code using a union (which it converts into shifts anyway), but then we have to deal with endianness.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26809#issuecomment-3225420652
More information about the hotspot-dev
mailing list