https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83169
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Iain Buclaw from comment #4) > The generated code sets the address of the constructed variable the same the > as the return address, yet the condition is assumed false by the optimizer. data is not taken as an address except in the equals so it cannot be the same as the global variable pointer. And using ptest after data goes out of scope in footest is undefined code. So the difference is just based on undefined code.