https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25829
--- Comment #28 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to Nicolas Koenig from comment #27) > program main > implicit none > open (10, file='foo.dat', asynchronous='yes') > call s() > close(10) > contains > subroutine s() > integer, dimension (3)::i !presumably on the stack > i = [0, 1] > write(10,*) i > !Now the stack frame is dropped and the pointer that previously > !pointed to the array now points to nowhere, but it is still enqueued > end subroutine > end program This program is illegal (J3/09-007r3, 9.6.4.1, paragraph 4), so you do not have to do anything about it. An interesting case is mixing of synchronous and asynchronous I/O for the same unit, which is permitted. I think this is like an implicit WAIT, same as a BACKSPACE, FLUSH, ...