https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119312

--- Comment #11 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
A struct with a const field is not a modifiable lvalue in C, so it's not valid
to assign to it. Modifying a const field with memcpy / byte accesses would
probably also violate "If an attempt is made to modify an object defined with a
const-qualified type through use of an lvalue with non-const-qualified type,
the behavior is undefined.". I think modifying padding with byte accesses
should be fine, however (just as modifying non-const fields in a structure with
a mixture of const and non-const fields is OK), since that's not defined with a
const-qualified type.

Reply via email to