https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103944
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Looking at the testcase, in fork child from a multi-threaded process only async signal safe functions can be called until it execs, are you sure nothing else is called?