1! { dg-do run }
2! PR libfortran/88411
3! This used to generate errors due to a mixup of
4! synchronous and asynchronous execution.
5! Test case by Harald Anlauf.
6program gfcbug153
7  implicit none
8  integer :: iu, irecl
9  real    :: a(100,20), b(1,3000)
10  iu = 10
11  a  = 0.
12  b  = 0.
13  inquire (iolength = irecl) a
14  open (iu, file="file1.dat", access='direct', &
15       asynchronous='yes', &
16       recl=irecl)
17  write(iu, rec=1) a(:,:)
18  write(iu, rec=2) a(:,:)
19  write(iu, rec=3) a(:,:)
20  close (iu,status="delete")
21
22  inquire (iolength = irecl) b
23  open (iu, file="file2.dat", access='direct', &
24       asynchronous='yes', &
25       recl=irecl)
26  write(iu, rec=1) b(:,:)
27  write(iu, rec=2) b(:,:)
28  write(iu, rec=3) b(:,:)
29  close (iu,status="delete")
30end program
31