https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82602
--- Comment #10 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- Yes, and moreover foo() could access non-volatile memory. And only a memory clobber can prevent the compiler from using cached values.