view gcc/testsuite/gfortran.dg/empty_format_1.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do run }
! { dg-options "-std=legacy" }
!
! PR 17709
! We weren't resetting the internal EOR flag correctly, so the second read
! wasn't advancing to the next line.
program main
  integer io_unit
  character*20 str
  io_unit = 10
  open (unit=io_unit,status='scratch',form='formatted')
  write (io_unit, '(A)') "Line1"
  write (io_unit, '(A)') "Line2"
  write (io_unit, '(A)') "Line3"
  rewind (io_unit)
  read (io_unit,'(A)') str
  if (str .ne. "Line1") STOP 1
  read (io_unit,'()')
  read (io_unit,'(A)') str
  if (str .ne. "Line3") STOP 2
  close(unit=io_unit)
end