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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Because when you enable optimizations the compiler can see that the contents of
junk are never used while still in scope, so the initialization is optimized
away.

Your program has undefined behaviour, that means the WHOLE program, including
inside that block.

Reply via email to