1! { dg-do run }
2! { dg-options "-ffrontend-optimize" }
3! PR 92569 - the EOF condition was not recognized with
4! -ffrontend-optimize.  Originjal test case by Bill Lipa.
5program main
6  implicit none
7  real(kind=8) ::  tdat(1000,10)
8  real(kind=8) :: res (10, 3)
9  integer :: i, j, k, np
10
11  open (unit=20, status="scratch")
12  res = reshape([(real(i),i=1,30)], shape(res))
13  write (20,'(10G12.5)') res
14  rewind 20
15  do  j = 1,1000
16     read (20,*,end=1)(tdat(j,k),k=1,10)
17  end do
18
191 continue
20  np = j-1
21  if (np /= 3) stop 1
22  if (any(transpose(res) /= tdat(1:np,:))) stop 2
23end program main
24