https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95104
--- Comment #4 from kargl at gcc dot gnu.org --- (In reply to Bill Long from comment #3) > A comment from the original user: gfortran 8.3.0 appears to do the right > thing. So perhaps a regression somewhere in the 9.x line? A note of the gfortran wiki says full asynchronous support became available in 9.1. SO, likely a bug introduced in 9. This fixes the segfault as it is never correct to dereference a NULL pointer. Index: libgfortran/io/transfer.c =================================================================== --- libgfortran/io/transfer.c (revision 280157) +++ libgfortran/io/transfer.c (working copy) @@ -4492,7 +4492,7 @@ void st_wait_async (st_parameter_wait *wtp) { gfc_unit *u = find_unit (wtp->common.unit); - if (ASYNC_IO && u->au) + if (ASYNC_IO && u && u->au) { if (wtp->common.flags & IOPARM_WAIT_HAS_ID) async_wait_id (&(wtp->common), u->au, *wtp->id); With this patch, your program prints '0'. Don't know if this is the only thing that needs fixing. Thanks for the bug report.