https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102586
--- Comment #24 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I bet with the default -flifetime-dse=2 we would then have a var = {}; var ={v} {CLOBBER}; // Start of ctor clobber var.whatever = ...; // Ctor content and the zero initialization would be optimized away then. I guess ideal would be to emit such zero initialization in the complete object ctors right after the -flifetime-dse=2 beginning clobber and ideally one that clearly says to the gimplifier and rest of middle-end that it must initialize even padding bits. Because right now gimplification of var = {} will often happily lower that to var.a = 0; var.b = 0; var.c = 0; even when there are padding bits, which is ok for most of ctors, but not ok for D and not ok for C++ zero initialization. So, I think we need some flag on CONSTRUCTORS requesting the initialize also padding bits behavior, set it for D ctors and for C++ zero initialization, properly propagate it through the C++ FE and honor it during gimplification (and wherever else it is needed).