From dd36913ccfae33ac8c4e4071cadcfaab99c72ce5 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Fri, 7 Sep 2007 20:23:40 +0000 Subject: [PATCH] re PR fortran/33307 (I/O read/positioning problem) 2007-09-07 Jerry DeLisle PR libfortran/33307 * gfortran.dg/backspace_10.f90: New test. From-SVN: r128254 --- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gfortran.dg/backspace_10.f90 | 37 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/backspace_10.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f704b279dd1..9ca621c2fbf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-09-07 Jerry DeLisle + + PR libfortran/33307 + * gfortran.dg/backspace_10.f90: New test. + 2007-09-07 Richard Guenther Reapply diff --git a/gcc/testsuite/gfortran.dg/backspace_10.f90 b/gcc/testsuite/gfortran.dg/backspace_10.f90 new file mode 100644 index 00000000000..574d464c4b3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/backspace_10.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! PR33307 I/O read/positioning problem - in BACKSPACE +! Test case devloped from test in PR by Jerry DeLisle +program gfcbug69b + ! Modified example program + implicit none + integer, parameter :: iunit = 63 + integer :: istat, k, ios + character(len=20) :: line, message + + open (iunit) + write (iunit, '(a)') "! ***Remove this line***" + write (iunit, '(a)') "&FOO file='foo' /" + write (iunit, '(a)', advance="no") "&BAR file='bar' /" + close (iunit) +! Note: Failure occurred only when ACTION="read" was specified + open (iunit, action="read", status="old") + + read (iunit,'(a)',iostat=ios) line + if (ios /= 0) call abort + read (iunit,'(a)',iostat=ios) line + if (ios /= 0) call abort + read (iunit,'(a)',iostat=ios) line + if (ios /= 0) call abort + read (iunit,'(a)',iostat=ios) line + if (ios /= 0) backspace (iunit) + rewind (iunit) + read (iunit,'(a)',iostat=ios) line + if (ios /= 0) call abort + read (iunit,'(a)',iostat=ios) line + if (ios /= 0) call abort + read (iunit,'(a)',iostat=ios) line + if (ios /= 0) call abort + read (iunit,'(a)',iostat=ios) line + if (ios /= -1) call abort + close (iunit, status="delete") +end program gfcbug69b -- 2.30.2