Our increasingly aggressive modern
compilers produce increasingly surprising code optimizations. Some of
these optimizations might be especially surprising to developers who assume
that each plain C-language load or store will always result in an
assembly-language load or store. Although this article is written for
Linux kernel developers, many of these scenarios also apply to other
concurrent code bases, keeping in mind that “concurrent code bases” also
includes single-threaded code bases that use interrupts or signals.
Source: LWN.net – [$] Who’s afraid of a big bad optimizing compiler?