Hi, this patch fixes issue PR/59807 "mutex misses destructor if non-function call initialization is used". This issue just got reported for mingw-w64, as this is the only venture providing posix-threading enabled toolchains (C++11). Nevertheless this issue could happen for other native Windows toolchains, too. Therefore I adjusted the default mingw32-case, too.
ChangeLog 2014-10-14 Kai Tietz <kti...@redhat.com> PR libstdc++/59807 * config/os/mingw32/os_defines.h (_GTHREAD_USE_MUTEX_INIT_FUNC): Define to avoid leak. * config/os/mingw32-w64/os_defines.h: Likewise. I am just testing bootstrap for it, and if successful, I will commit. Thanks, Kai Index: config/os/mingw32/os_defines.h =================================================================== --- config/os/mingw32/os_defines.h (Revision 216199) +++ config/os/mingw32/os_defines.h (Arbeitskopie) @@ -75,4 +75,7 @@ #define _GLIBCXX_LLP64 1 #endif +// See libstdc++/59807 +#define _GTHREAD_USE_MUTEX_INIT_FUNC 1 + #endif Index: config/os/mingw32-w64/os_defines.h =================================================================== --- config/os/mingw32-w64/os_defines.h (Revision 216199) +++ config/os/mingw32-w64/os_defines.h (Arbeitskopie) @@ -83,4 +83,7 @@ // their dtors are called #define _GLIBCXX_THREAD_ATEXIT_WIN32 1 +// See libstdc++/59807 +#define _GTHREAD_USE_MUTEX_INIT_FUNC 1 + #endif