RFR: 8337683: Fix -Wconversion problem with arrayOop.hpp [v5]
David Holmes
dholmes at openjdk.org
Thu Aug 8 05:17:35 UTC 2024
On Wed, 7 Aug 2024 21:05:05 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Since base_offset_in_bytes and HeapWordSize are int, there's no loss of conversion in making these variables int. This seems trivial.
>> Tested with tier1 on linux and windows.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>
> See if GHA compilers like this.
src/hotspot/share/oops/arrayOop.hpp line 74:
> 72: #ifdef ASSERT
> 73: // make sure it isn't called before UseCompressedOops is initialized.
> 74: static int arrayoopdesc_hs = 0;
Why not just do a `checked_cast<int>` on the return statement? (or even a range assert and a static cast?)
src/hotspot/share/utilities/byteswap.hpp line 67:
> 65: struct ByteswapFallbackImpl<T, 2> {
> 66: inline constexpr uint16_t operator()(uint16_t x) const {
> 67: return checked_cast<uint16_t>(((x & UINT16_C(0x00ff)) << 8) | ((x & UINT16_C(0xff00)) >> 8));
What is the type of the expression without the cast?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20431#discussion_r1708633394
PR Review Comment: https://git.openjdk.org/jdk/pull/20431#discussion_r1708630156
More information about the hotspot-dev
mailing list