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 05:33:03 UTC 2025
On Mon, 10 Nov 2025 05:15:01 GMT, Jan Kratochvil <jkratochvil at openjdk.org> wrote:
>> 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.
>
> I have removed it, but I disagree, as there’s no way to make such a foolproof assertion in C++.
My objection to the original comments is they don't explain the purpose of the explicit paddings, or how to "verify no compiler paddings are present". I think it's better to add a comment like:
// The explicit paddings are necessary for generating deterministic CDS archives. They prevent
// the C++ compiler from potentially inserting random values in unused gaps.
So if someone changes this file and the CDS tests fails, the comment will give them some ideas about how to fix the problem.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26098#discussion_r2508774649
More information about the hotspot-dev
mailing list