diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-03-11 16:44:57 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-03-11 17:52:56 +0000 |
commit | 15825b17cf3fbf28181c51fe94a2898f448f915c (patch) | |
tree | c00f1a3a4669e03a18adeb7a5d7f65a176513cf0 /gcc/ada/gcc-interface/utils.c | |
parent | 8cfb387388a90730ab36ac24d9049677db633a11 (diff) | |
download | gcc-15825b17cf3fbf28181c51fe94a2898f448f915c.zip gcc-15825b17cf3fbf28181c51fe94a2898f448f915c.tar.gz gcc-15825b17cf3fbf28181c51fe94a2898f448f915c.tar.bz2 |
libstdc++: Use acq_rel memory ordering [PR 99537]
As Lewis Baker wrote in the PR:
> The 'fetch_sub()' operation in _M_release_ownership() should be using
> memory_order::acq_rel instead of memory_order::release. The use of
> 'release' only is insufficient as it does not synchronise with any
> corresponding 'acquire' operation.
> With the current implementation, it's possible that a prior write to
> one of the _M_value or _M_head data-members by a thread releasing the
> second-to-last reference might not be visible to another thread that
> releases the last reference and frees the memory, resulting in
> potential write to freed memory.
This simply changes the memory order to acq_rel as suggested.
libstdc++-v3/ChangeLog:
PR libstdc++/99537
* include/std/stop_token (_Stop_state_t::_M_release_ownership):
Use acq_rel memory ordering.
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
0 files changed, 0 insertions, 0 deletions