RFR: 8337683: Fix -Wconversion problem with arrayOop.hpp
Stefan Karlsson
stefank at openjdk.org
Fri Aug 2 06:48:31 UTC 2024
On Thu, 1 Aug 2024 18:49:34 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.
This doesn't seem to be enough to fix -Wconversion for this file. It just pushes the problem down to line 142.
I ran your patch with -Wconversion -ferror-limit=20000 and searched for arrayOop.hpp and it gives me:
src/hotspot/share/oops/arrayOop.hpp:71:17: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
size_t hs = length_offset_in_bytes() + sizeof(int);
^~~~~~~~~~~~~~~~~~~~~~~~ ~
src/hotspot/share/oops/arrayOop.hpp:91:17: error: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
size_t hs = header_size_in_bytes();
~~ ^~~~~~~~~~~~~~~~~~~~~~
src/hotspot/share/oops/arrayOop.hpp:142:43: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
align_down((SIZE_MAX/HeapWordSize - hdr_size_in_words), MinObjAlignment);
~ ^~~~~~~~~~~~~~~~~
src/hotspot/share/oops/arrayOop.hpp:144:53: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
HeapWordSize * max_element_words_per_size_t / type2aelembytes(type);
~ ^~~~~~~~~~~~~~~~~~~~~
-------------
Changes requested by stefank (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/20431#pullrequestreview-2214782228
More information about the hotspot-dev
mailing list