RFR: 8357579: Compilation error: first argument in call to 'memset' is a pointer to non-trivially copyable type [v11]

Ioi Lam iklam at openjdk.org
Mon Nov 10 04:32:04 UTC 2025


On Fri, 7 Nov 2025 17:07:37 GMT, Jan Kratochvil <jkratochvil at openjdk.org> wrote:

>> With clang-20 using --with-toolchain-type=clang resolveFieldEntry.cpp and resolveMethodEntry.cpp break the build with similar warnings like:
>> 
>> src/hotspot/share/oops/resolvedFieldEntry.cpp:49:10: error: first argument in call to 'memset' is a pointer to non-trivially copyable type 'ResolvedFieldEntry' [-Werror,-Wnontrivial-memcall]
>>    49 |   memset(this, 0, sizeof(*this));
>>       |          ^
>> src/hotspot/share/oops/resolvedFieldEntry.cpp:49:10: note: explicitly cast the pointer to silence this warning
>>    49 |   memset(this, 0, sizeof(*this));
>>       |          ^
>>       |          (void*)
>> 
>> The patch follows the suggested fix.
>
> Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove the sizeof == const assertions

Looks good to me. Thanks for your patience in finding a good solution for this issue. I just have a minor nit about the comments.

src/hotspot/share/oops/resolvedFieldEntry.hpp line 47:

> 45: 
> 46: // Verify no compiler paddings are present, check STATIC_ASSERTs in the .cpp file.
> 47: 

I think this comment is not necessary.

src/hotspot/share/oops/resolvedMethodEntry.hpp line 65:

> 63: 
> 64: // Verify no compiler paddings are present, check STATIC_ASSERTs in the .cpp file.
> 65: 

Comment not necessary.

-------------

Marked as reviewed by iklam (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26098#pullrequestreview-3440751612
PR Review Comment: https://git.openjdk.org/jdk/pull/26098#discussion_r2508674536
PR Review Comment: https://git.openjdk.org/jdk/pull/26098#discussion_r2508675810


More information about the hotspot-dev mailing list