1! { dg-do run }
2! { dg-options -w }
3! PR 26661 : Test reading X's past file end with no LF or CR.
4! PR 26880 : Tests that rewind clears the gfc_unit read_bad flag.
5! PR 43265 : Tests that no error occurs with or without X at end.
6! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
7      implicit none
8      character(3) a(4)
9      integer i
10      open (10, status="scratch")
11 10   format(A,$)  ! This is not pedantic
12      write(10,10)' abc def ghi jkl'
13      rewind(10)
14
15      a = ""
16      read(10,20)(a(i),i=1,4)
17      if (a(4).ne."jkl") call abort()
18
19      rewind(10)
20
21      a = ""
22      read(10,30)(a(i),i=1,4)
23      if (a(4).ne."jkl") call abort()
24
25 20   format(1x,a3,1x,a3,1x,a3,1x,a3,10x)
26 30   format(1x,a3,1x,a3,1x,a3,1x,a3)
27      close(10)
28      end
29