https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77704
--- Comment #5 from Boris Kolpackov <boris at kolpackov dot net> --- For anyone interested, here is the workaround we came up with: // A data race happens in the libstdc++ (as of GCC 7.2) implementation of the // ctype<ctype>::narrow() function (bug #77704). The issue is easily triggered // by the testscript runner that indirectly (via regex) uses ctype<char> facet // of the global locale (and can potentially be triggered by other locale- // aware code). We work around this by pre-initializing the global locale // facet internal cache. // #ifdef _GLIBCXX_ { const ctype<char>& ct (use_facet<ctype<char>> (locale ())); for (size_t i (0); i != 256; ++i) ct.narrow (static_cast<char> (i), '\0'); } #endif