1! { dg-do run } 2! { dg-options "-std=legacy" } 3! 4! PR 17709 5! We weren't resetting the internal EOR flag correctly, so the second read 6! wasn't advancing to the next line. 7program main 8 integer io_unit 9 character*20 str 10 io_unit = 10 11 open (unit=io_unit,status='scratch',form='formatted') 12 write (io_unit, '(A)') "Line1" 13 write (io_unit, '(A)') "Line2" 14 write (io_unit, '(A)') "Line3" 15 rewind (io_unit) 16 read (io_unit,'(A)') str 17 if (str .ne. "Line1") call abort 18 read (io_unit,'()') 19 read (io_unit,'(A)') str 20 if (str .ne. "Line3") call abort 21 close(unit=io_unit) 22end 23 24