mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-19 00:55:13 +08:00
libstdc++: Fix UB in atomic_ref/wait_notify.cc [PR101761]
Remove UB in atomic_ref/wait_notify test. Signed-off-by: Thomas Rodgers <trodgers@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/101761 * testsuite/29_atomics/atomic_ref/wait_notify.cc (test): Use va and vb as arguments to wait/notify, remove unused bb local.
This commit is contained in:
parent
93b5a66710
commit
f9f1a6efaa
@ -33,15 +33,14 @@ template<typename S>
|
||||
if constexpr (std::atomic_ref<S>::is_always_lock_free)
|
||||
{
|
||||
S aa{ va };
|
||||
S bb{ vb };
|
||||
std::atomic_ref<S> a{ aa };
|
||||
a.wait(bb);
|
||||
a.wait(vb);
|
||||
std::thread t([&]
|
||||
{
|
||||
a.store(bb);
|
||||
a.store(vb);
|
||||
a.notify_one();
|
||||
});
|
||||
a.wait(aa);
|
||||
a.wait(va);
|
||||
t.join();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user