https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102586
qinzhao at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |qinzhao at gcc dot gnu.org --- Comment #25 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #24) > 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, oh right, I recall that this was the reason why adding "var = {}" to initialize the whole structure didn't work well for initialize all paddings. therefore we have to explicitly call __builtin_clear_padding for clear all paddings.