https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112635
--- Comment #2 from Agostino Sarubbo <ago at gentoo dot org> --- (In reply to Richard Biener from comment #1) > Yep, GCC fixes the code for you by eliding 'buf'. That's perfectly OK though > since the code invokes undefined behavior. > > I'm inclined to close this as INVALID/WONTFIX, it isn't really a bug > (but also not a feature you can rely on of course). Thanks for the response. So the question is: to have a reliable ssp, do I have to use -O0 ?