https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90038
--- Comment #7 from Janne Blomqvist <jb at gcc dot gnu.org> --- This should fix it: --- a/libgfortran/intrinsics/execute_command_line.c +++ b/libgfortran/intrinsics/execute_command_line.c @@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #ifdef HAVE_POSIX_SPAWN #include <spawn.h> +#include <signal.h> extern char **environ; #endif @@ -83,6 +84,9 @@ execute_command_line (const char *command, bool wait, int *exitstat, set_cmdstat (cmdstat, EXEC_NOERROR); #ifdef HAVE_POSIX_SPAWN + /* As of POSIX.1-2001, setting SIGCHLD to SIG_IGN makes the + kernel automatically reap zombies. */ + signal (SIGCHLD, SIG_IGN); const char * const argv[] = {"sh", "-c", cmd, NULL}; if (posix_spawn (&pid, "/bin/sh", NULL, NULL, (char * const* restrict) argv, environ))