RFR: 8300800: UB: Shift exponent 32 is too large for 32-bit type 'int'
Kim Barrett
kbarrett at openjdk.org
Sun Aug 11 04:54:37 UTC 2024
On Fri, 9 Aug 2024 17:54:17 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
> The operand of shift which is a constant `0` changed to `unsigned long`.
This should use UCONST64 instead of a UL suffix, because that suffix is
platform-dependent. Windows is LLP64, so L is 32 bits. This is code that is
(probably, I haven't checked for sure) used by the windows-aarch64 port.
Changes requested by kbarrett (Reviewer).
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 = (0UL << nbits) | or_bits_sub;
This should use UCONST64 instead of a UL suffix, because that suffix is platform-dependent. Windows is
LLP64, so L is 32 bits. This is code that is (probably, I haven't checked for sure) used by the windows-aarch64
port.
-------------
Changes requested by kbarrett (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/20530#pullrequestreview-2231737254
PR Review: https://git.openjdk.org/jdk/pull/20530#pullrequestreview-2231737350
PR Review Comment: https://git.openjdk.org/jdk/pull/20530#discussion_r1712907362
More information about the hotspot-compiler-dev
mailing list