I think I've managed to get a (slightly revised) patch to the mailing list.
I neglected to mention, these destructors are registered with __cxa_thread_atexit, and despite commit messages to the contrary, the version of that from this project is used by gcc. I was thinking something along these lines (solves the simple test case), but then I worry that any thread_local that the destructors might reference would already be gone, too. diff --git a/mingw-w64-crt/crt/tls_atexit.c b/mingw-w64-crt/crt/tls_atexit.c index 1062106d..8651098c 100644 --- a/mingw-w64-crt/crt/tls_atexit.c...
thread_local destructors not called at thread exit