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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> Your program has undefined behaviour, that means the WHOLE program,
> including inside that block.

Or in the case where you copy the pointer, and then overwrite it with another
value, that isn't undefined, but the value is not used. The point of
optimization is to remove unnecessary code, like setting bytes in memory that
will never get read back again.

If the contents of junk are not needed, why waste cycles initializing those
bytes?

Reply via email to