diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2006-09-15 13:32:12 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2006-09-15 13:32:12 +0000 |
commit | 61943a216576f8e1f7de347d2ef56883e2b746d8 (patch) | |
tree | 1bd5ed9360c333eb66ec9373c10f902224395d59 | |
parent | 701306112e8d1d108451bccd58f9ccd84ffe81c1 (diff) | |
download | gcc-61943a216576f8e1f7de347d2ef56883e2b746d8.zip gcc-61943a216576f8e1f7de347d2ef56883e2b746d8.tar.gz gcc-61943a216576f8e1f7de347d2ef56883e2b746d8.tar.bz2 |
re PR fortran/29053 (Consecutive STREAM I/O file positions mixed up)
2006-09-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/29053
* gfortran.dg/streamio_9.f90: New test.
* gfortran.dg/streamio_10.f90: New test.
From-SVN: r116971
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/streamio_10.f90 | 37 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/streamio_9.f90 | 31 |
3 files changed, 74 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd06af6..cc431da 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-09-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/29053 + * gfortran.dg/streamio_9.f90: New test. + * gfortran.dg/streamio_10.f90: New test. + 2006-09-14 Andrew Pinski <pinskia@physics.uc.edu> PR C++/29002 diff --git a/gcc/testsuite/gfortran.dg/streamio_10.f90 b/gcc/testsuite/gfortran.dg/streamio_10.f90 new file mode 100644 index 0000000..e49617e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/streamio_10.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! PR25093 Stream IO test 10 +! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>. +! Test case derived from that given in PR by Steve Kargl. +program stream_io_10 + implicit none + integer :: a(4), b(4) + integer(kind=8) :: thepos + a = (/ 1, 2, 3, 4 /) + b = a + open(10, file="teststream", access="stream") + write(10) a + inquire(10, pos=thepos) + if (thepos.ne.17) call abort() + + read(10, pos=1) + inquire(10, pos=thepos) + if (thepos.ne.1) call abort() + + write(10, pos=15) + inquire(10, pos=thepos) + if (thepos.ne.15) call abort() + + read(10, pos=3) + inquire(10, pos=thepos) + if (thepos.ne.3) call abort() + + write(10, pos=1) + inquire(10, pos=thepos) + if (thepos.ne.1) call abort() + + a = 0 + read(10) a + if (any(a /= b)) call abort() + + close(10, status="delete") +end program stream_io_10 diff --git a/gcc/testsuite/gfortran.dg/streamio_9.f90 b/gcc/testsuite/gfortran.dg/streamio_9.f90 new file mode 100644 index 0000000..150c1c6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/streamio_9.f90 @@ -0,0 +1,31 @@ +! { dg-do run } +! PR29053 Stream IO test 9. +! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>. +! Test case derived from that given in PR by Steve Kargl. +program pr29053 + implicit none + real dt, t, u, a(10), b(10) + integer i, place + dt = 1.e-6 + a = real( (/ (i, i=1, 10) /) ) + b = a + open(unit=11, file='a.dat', access='stream') + open(unit=12, file='b.dat', access='stream') + do i = 1, 10 + t = i * dt + write(11) t + write(12) a + end do + rewind(11) + rewind(12) + do i = 1, 10 + t = i * dt + read(12) a + if (any(a.ne.b)) call abort() + read(11) u + if (u.ne.t) call abort() + end do + close(11, status="delete") + close(12, status="delete") +end program pr29053 + |