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

--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Mon, 3 Sep 2018, pjp at fedoraproject dot org wrote:

> As from the reply, it would be nice to have four options/features available
> from the compiler, from least to most performance impact:
> 
>  - initialize padding to zero when static initializers are used (this would 
>    make foo = { .field = something }; identical to memset(&foo, 0, 
>    sizeof(foo)); foo.field = something for all structures, but now, any 
>    structures with padding _must_ use the latter to be safe, which is highly 
>    error-prone).

Presumably that sort of thing would need to come with a guarantee that 
SRA, structure assignment etc. preserve padding (rather than padding 
contents potentially being lost if a structure is subject to SRA)?

(Both are effectively treating padding like additional named fields for 
the purposes of code generation but without affecting what fields the 
front end associates initializers with.  I'd expect the performance costs 
of such guarantees associated with padding to be small.)

Reply via email to