RFR: 8357579: Compilation error: first argument in call to 'memset' is a pointer to non-trivially copyable type [v7]
Ioi Lam
iklam at openjdk.org
Fri Nov 7 04:44:02 UTC 2025
On Thu, 6 Nov 2025 22:44:40 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:
>
> Fix 32-bit compilation error
Thanks for the update. I will run it through our CI to see if the deterministic CDS tests pass.
I think we should replace the memset with the following, per @kimbarrett 's comment on [JBS](https://bugs.openjdk.org/browse/JDK-8357579?focusedId=14831517&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14831517)
::new (this) ResolvedFieldEntry();
I tried it on Linux and it worked. I will test on all platforms.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26098#issuecomment-3500680077
More information about the hotspot-dev
mailing list