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

Jan Kratochvil jkratochvil at openjdk.org
Fri Nov 7 17:07:39 UTC 2025


On Fri, 7 Nov 2025 16:59:18 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> True. So I have added both. That sizeof check is for the case of:
>> 
>>  class ResolvedFieldEntry {
>>    friend class VMStructs;
>>  
>> +  u4 _new_field;
>>    InstanceKlass* _field_holder; // Field holder klass
>> 
>> Although it is a bit difficult to introduce an accidental padding inside the struct which is caught by my assertion and not by your assertion. So I can also remove the assertion of mine if you think so.
>
> My assert also fails for your new scenario. I think we shouldn't have the hard coded numbers unless you find a case not covered by my assert. Otherwise when someone changes the class they need to update 4 hard coded numbers, which can be error prone (most people don't have 32-bit build environments).

Such a case I have provided above (after editing it) but I have removed the assertion as its usefulness is not big. A 32-bit build is being tested by arm32 Github GHA.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26098#discussion_r2504615209


More information about the hotspot-dev mailing list