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

--- Comment #10 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
If you care about information in bytes that are not part of a field with 
other semantic significance, you should use -Werror=padded to get errors 
on structs with padding and use that information to add explicit dummy 
fields in the source code where there was padding.  Once there are 
explicit dummy fields, their values will be preserved by the compiler, so 
you can either zero the whole struct with memset and rely on the zeroing 
of dummy fields not being optimized away, or use a struct initializer and 
rely on it implicitly zeroing those fields.  (Of course this may reduce 
efficiency as optimizations such as SRA now need to track values of those 
fields, whereas they do not need to track values of padding.)

Reply via email to