https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115802
--- Comment #7 from Phosit <phosit at autistici dot org> --- Yes you are right. There is a race because of the first access. But your example also does that > while (!var) > fence(); ... Whatever, there is certainly is a bug.