https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113401
--- Comment #4 from Florian Weimer <fw at gcc dot gnu.org> --- (In reply to Iain Sandoe from comment #3) > for platforms using pthreads as the underlying resource, then perhaps we can > do this without thread_atexit (which I do not see in many places) by using > pthread_cleanup_push () The current implementation already uses the same underlying mechanism as pthread_cleanup_push if building with -fexceptions. It does not solve the leak because the outermost handler deliberately does not perform a full deallocation of the thread state.