https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113401
--- Comment #6 from Florian Weimer <fw at gcc dot gnu.org> --- Sorry, pthread_cleanup_push is purely scope-based, like the existing handler. It cannot be used to push a handler to some unscoped cleanup function list that persists even after the current function returns. It's also implemented as a macro, so it's not possible to emit it from builtin expansion.