https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71312
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- A slightly simpler fix: --- a/libstdc++-v3/src/c++11/shared_ptr.cc +++ b/libstdc++-v3/src/c++11/shared_ptr.cc @@ -34,7 +34,9 @@ namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden) __gnu_cxx::__mutex& get_mutex(unsigned char i) { - static __gnu_cxx::__mutex m[mask + 1]; + // increase alignment to ensure each lock is on a separate cache line + struct alignas(64) M : __gnu_cxx::__mutex { }; + static M m[mask + 1]; return m[i]; } }