diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-10-09 16:59:56 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-10-09 16:59:56 +0100 |
commit | cc386cf23346d7cf78493390c4fe1e3ca4f171e6 (patch) | |
tree | aa639bd1f2716137d71ac6507663d9e968c549e5 /gcc/c-family/c-cppbuiltin.c | |
parent | 4a8841c0413d52261a8d024577381582d07a866a (diff) | |
download | gcc-cc386cf23346d7cf78493390c4fe1e3ca4f171e6.zip gcc-cc386cf23346d7cf78493390c4fe1e3ca4f171e6.tar.gz gcc-cc386cf23346d7cf78493390c4fe1e3ca4f171e6.tar.bz2 |
PR libstdc++/91057 set locale::id::_M_index atomically
If two threads see _M_index==0 concurrently they will both try to set
it, potentially storing the facet at two different indices in the array.
Either set the _M_index data member using an atomic compare-exchange
operation or while holding a mutex.
Also move the LONG_DOUBLE_COMPAT code into a separate function to remove
the visual noise it creates.
PR libstdc++/91057
* src/c++98/locale.cc (locale::id::_M_id()) [__GTHREADS]: Use atomic
compare-exchange or double-checked lock to ensure only one thread sets
the _M_index variable.
[_GLIBCXX_LONG_DOUBLE_COMPAT]: Call find_ldbl_sync_facet to detect
facets that share another facet's ID.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (find_ldbl_sync_facet): New function.
From-SVN: r276762
Diffstat (limited to 'gcc/c-family/c-cppbuiltin.c')
0 files changed, 0 insertions, 0 deletions