https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106843
--- Comment #7 from Dave A <gcc at linuxmotors dot com> --- -fsanitize=address balked on the executable even without the -O2, even though it printed out the correct values. The stack must have been initialzed and the values persisted after the variable went out of scope. In retrospect I'm surprised this ever worked. I have a vague memory of copying this "trick" from libSDL source. Thanks for investigating.