Committed as obvious. The invalid NULL pointer dereference was discovered by Steve Kargl.
Will backport in a few days, when I figure out how to do it now. Thanks, Harald PR fortran/95104 - Segfault on a legal WAIT statement Referencing a unit in a WAIT statement that has not been opened before resulted in a NULL pointer dereference. Check for this condition. 2020-05-26 Harald Anlauf <anl...@gmx.de> libgfortran/ PR libfortran/95104 * io/transfer.c (st_wait_async): Do not dereference NULL pointer. gcc/testsuite/ PR libfortran/95104 * gfortran.dg/pr95104.f90: New test. Co-Authored-By: Steven G. Kargl <ka...@gcc.gnu.org>