https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70889
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Testcase: #include <atomic> #include <iostream> std::atomic<std::size_t> seq_; std::size_t value; auto load() { std::size_t copy; std::size_t seq0; do { seq0 = seq_.load(); if (!seq0) continue; copy = value; seq0 = seq_.load(); } while (!seq0); return copy; }