[Bug libstdc++/71312] New: mutexes for shared_ptr atomics should be padded to cacheline size
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 27 15:56:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71312
Bug ID: 71312
Summary: mutexes for shared_ptr atomics should be padded to
cacheline size
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
src/c++11/shared_ptr.cc has:
__gnu_cxx::__mutex&
get_mutex(unsigned char i)
{
static __gnu_cxx::__mutex m[mask + 1];
return m[i];
}
This should be:
__gnu_cxx::__mutex&
get_mutex(unsigned char i)
{
struct M {
alignas(C) __gnu_cxx::__mutex mx;
};
static M m[mask + 1];
return m[i].mx;
}
where C == std::hardware_destructive_interference_size
More information about the Gcc-bugs
mailing list