RFR: 8300800: UB: Shift exponent 32 is too large for 32-bit type 'int' [v2]
Kim Barrett
kbarrett at openjdk.org
Mon Aug 12 09:26:31 UTC 2024
On Mon, 12 Aug 2024 08:19:44 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> The operand of shift which is a constant `0` changed to `unsigned long`.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>
> Used UCONST64(0) instead of UL.
src/hotspot/cpu/aarch64/immediate_aarch64.cpp line 298:
> 296: uint64_t or_bits_sub = replicate(or_bit, 1, nbits);
> 297: uint64_t and_bits_top = (and_bits_sub << nbits) | ones(nbits);
> 298: uint64_t or_bits_top = (UCONST64(0) << nbits) | or_bits_sub;
I focused on the UL suffix earlier, and didn't really think about what this is doing. Why are we shifting
a zero value at all? This equivalent to `uint64_t or_bits_top = or_bits_sub;`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20530#discussion_r1713423493
More information about the hotspot-compiler-dev
mailing list