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

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Something glaringly obvious just struck me: The test case
has synchronous writes for a file which is opened asynchronously.

This may or may not have been intended.  It is certainly a bug
not to get this right, but at least there is a workaround:
Rewrite the test case as

program gfcbug153
  implicit none
  integer :: iu, irecl
  real    :: a(100,20), b(1,3000)
  iu = 10
  a  = 0.
  b  = 0.
  inquire (iolength = irecl) a
  open (iu, file="file1.dat", access='direct', &
       asynchronous='yes', &
       recl=irecl)
  write(iu, rec=1,asynchronous="yes") a(:,:)
  write(iu, rec=2,asynchronous="yes") a(:,:)
  write(iu, rec=3,asynchronous="yes") a(:,:)
  close (iu)

  inquire (iolength = irecl) b
  open (iu, file="file2.dat", access='direct', &
       asynchronous='yes', &
       recl=irecl)
  write(iu, rec=1,asynchronous="yes") b(:,:)
  write(iu, rec=2,asynchronous="yes") b(:,:)
  write(iu, rec=3,asynchronous="yes") b(:,:)
  close (iu)
end program

That appears to work, at least according to the
testing that I did.

Reply via email to