https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71885
--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- For the record, I was against enabling this optimization by default. (Because the potential gain doesn't justify the possible confusion it may cause. And -fsanitize=undefined doesn't catch these issues yet.) But in the end it is just another instance were the compiler correctly assumes that undefined behavior will never happen and so optimizes accordingly. The issue is that the object has an indeterminate value when the constructor starts, so stores to it before this point are lost.