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
This commit is contained in:
Jerry DeLisle 2006-09-15 13:32:12 +00:00
parent 701306112e
commit 61943a2165
3 changed files with 74 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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