https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86056
--- Comment #2 from Mathias Stearn <redbeard0531 at gmail dot com> --- Oh, I agree that this optimization must be permitted. I was using this example to prove this to someone else who didn't believe that. I only mentioned that to explain how that weird source code came to be. My point of this bug was that the code gen can be further optimized because there is never a good reason to have multiple mfence instructions back to back like that.