1! { dg-do run { target fd_truncate } }
2! PR30435 Slash at end of input not recognized according to standard.
3! Test case from PR by Steve Kargl.
4
5program t
6  integer a, b, c, d
7  ! This worked as expected
8  open(unit=10, file='tmp.dat')
9  write(10,*) '1 2 3 / 4'
10  rewind(10)
11  a = -1; b = -1; c = -1; d = -1;
12  read(10,*) a,b,c,d
13  if (d.ne.-1) call abort()
14
15  ! This worked as expected
16  rewind(10)
17  write(10,*) '1 2 3 /'
18  rewind(10)
19  a = -2; b = -2; c = -2; d = -2;
20  read(10,*) a,b,c,d
21  if (d.ne.-2) call abort()
22
23  ! This worked as expected.
24  rewind(10)
25  write(10,*) '1 2'
26  write(10,*) '3 /'
27  rewind(10)
28  a = -3; b = -3; c = -3; d = -3;
29  read(10,*) a,b,c,d
30  if (d.ne.-3) call abort()
31
32  ! This failed before the patch.
33  rewind(10)
34  write(10,*) '1 2 3'
35  write(10,*) '/'
36  rewind(10)
37  a = -4; b = -4; c = -4; d = -4;
38  read(10,*) a,b,c,d
39  if (d.ne.-4) call abort()
40
41  close(unit=10, status='delete')
42end program t
43