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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Bar has no user-provided default constructor, so indeed the
value-initialization of Bar is zero-initialization followed by
default-initialization.
But, Foo has user-provided default constructor though, and at the start of such
a constructor the object has indeterminate value, so while zero-initialization
initialized the padding bits before, that is ignored later on.  It is the same
thing as if you
memset some automatic object's storage to zero and then invoke a default
constructor there.
You can use -flifetime-dse=1 or -fno-lifetime-dse to disable this behavior, see
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flifetime-dse

Reply via email to