1! { dg-do run }
2! PR33307 I/O read/positioning problem - in BACKSPACE
3! Test case devloped from test in PR by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
4program gfcbug69b
5  ! Modified example program
6  implicit none
7  integer, parameter :: iunit = 63
8  integer            :: istat, k, ios
9  character(len=20) :: line, message
10
11  open (iunit)
12  write (iunit, '(a)') "! ***Remove this line***"
13  write (iunit, '(a)') "&FOO        file='foo' /"
14  write (iunit, '(a)', advance="no") "&BAR        file='bar' /"
15  close (iunit)
16! Note: Failure occurred only when ACTION="read" was specified
17  open (iunit, action="read", status="old")
18
19  read (iunit,'(a)',iostat=ios) line
20  if (ios /= 0) call abort
21  read (iunit,'(a)',iostat=ios) line
22  if (ios /= 0) call abort
23  read (iunit,'(a)',iostat=ios) line
24  if (ios /= 0) call abort
25  read (iunit,'(a)',iostat=ios) line
26  if (ios /= 0) backspace (iunit)
27  rewind (iunit)
28  read (iunit,'(a)',iostat=ios) line
29  if (ios /= 0) call abort
30  read (iunit,'(a)',iostat=ios) line
31  if (ios /= 0) call abort
32  read (iunit,'(a)',iostat=ios) line
33  if (ios /= 0) call abort
34  read (iunit,'(a)',iostat=ios) line
35  if (ios /= -1) call abort
36  close (iunit, status="delete")
37end program gfcbug69b
38