https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101761
Florian Weimer <fw at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fw at gcc dot gnu.org --- Comment #4 from Florian Weimer <fw at gcc dot gnu.org> --- I think it's a test bug: std::atomic_ref<S> a{ aa }; std::thread t([&] { a.store(bb); a.notify_one(); }); a.wait(aa); Due to the use of std::atomic_ref, store() overwrites aa with the value of bb. If the notify_one() call completes before the wait() call, wait() blocks because aa == bb (due to the previous store()), and the wakeup never happens because wakes are not queued.