https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15596
--- Comment #33 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 14 Jan 2020, pinskia at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15596 > > Andrew Pinski <pinskia at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Assignee|rguenth at gcc dot gnu.org |pinskia at gcc dot > gnu.org > Target Milestone|8.4 |11.0 > > --- Comment #32 from Andrew Pinski <pinskia at gcc dot gnu.org> --- > Mine for GCC 11. I have patches which improve this a lot. > The problem right now is the padding. > > I have an idea where we initialize all structs non-addressed local variables > that have a non VOIDmode right before their first use. > Kinda like init-regs does on the RTL but a little more complex. > > That is having: > bitstr fun(int s, int l) > { > bitstr res; > *(int*)&res = 0; > res.a = s; > res.b = 1; > res.c = 0; > res.d = l; > return res; > } > > Will produce better code always :). Something like init-regs I'd not like. But the above should be detectable by store-merging in some way - store-merging can merge across "uninitialized" bits (by using zeroing or any other convenient value).