https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94143

--- Comment #4 from Tomáš Trnka <trnka at scm dot com> ---
(In reply to anlauf from comment #3)
> Funny.  I do not get failures when compiling with -fsanitize=thread.

I don't think TSAN can help here. This is not a data race between two threads,
but between our SIGCHLD signal handler calling wait() and the wait() inside
system().

So once the shell spawned by system() exits, one of the following happens:

A) everything works OK
SIGCHLD handler fires and calls wait()
wait() in system() reaps the child and returns exit status
wait() in signal handler fails with ECHILD but errors are ignored anyway

B) this bug
SIGCHLD handler fires and calls wait()
wait() in signal handler reaps the child (and ignores its exit status)
wait() in system() fails with ECHILD, triggering a Fortran runtime error

Reply via email to