[Bug libfortran/94143] [9/10/11 Regression] Asynchronous execute_command_line() breaks following synchronous calls

trnka at scm dot com gcc-bugzilla@gcc.gnu.org
Fri May 8 09:57:45 GMT 2020


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


More information about the Gcc-bugs mailing list