https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66881
JF Bastien <jfb at chromium dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jfb at chromium dot org --- Comment #6 from JF Bastien <jfb at chromium dot org> --- I don't think this is a duplicate of PR 50677: this issue uses two *separate* atomic operations, which inherently aren't atomic, whereas PR 50677 uses a single volatile operations which some (misguided) developers expect to be atomic. The compiler may decide to be nice to developers who have misguided expectations from using volatile, but this example clearly uses separate load/store operations. I believe Thomas is correct: the code for f() should codegen the same code as g().