! { dg-do run }
|
! { dg-do run }
|
! { dg-options "-frecord-marker=4" }
|
! { dg-options "-frecord-marker=4" }
|
! This file is all about BACKSPACE
|
! This file is all about BACKSPACE
|
! Adapted from gfortran.dg/backspace.f
|
! Adapted from gfortran.dg/backspace.f
|
|
|
integer i, n, nr
|
integer i, n, nr
|
real x(10), y(10)
|
real x(10), y(10)
|
|
|
! PR libfortran/20068
|
! PR libfortran/20068
|
open (20, status='scratch')
|
open (20, status='scratch')
|
write (20,*) 1
|
write (20,*) 1
|
write (20,*) 2
|
write (20,*) 2
|
write (20,*) 3
|
write (20,*) 3
|
rewind (20)
|
rewind (20)
|
read (20,*) i
|
read (20,*) i
|
if (i .ne. 1) call abort
|
if (i .ne. 1) call abort
|
backspace (20)
|
backspace (20)
|
read (20,*) i
|
read (20,*) i
|
if (i .ne. 1) call abort
|
if (i .ne. 1) call abort
|
close (20)
|
close (20)
|
|
|
! PR libfortran/20125
|
! PR libfortran/20125
|
open (20, status='scratch')
|
open (20, status='scratch')
|
write (20,*) 7
|
write (20,*) 7
|
backspace (20)
|
backspace (20)
|
read (20,*) i
|
read (20,*) i
|
if (i .ne. 7) call abort
|
if (i .ne. 7) call abort
|
close (20)
|
close (20)
|
|
|
open (20, status='scratch', form='unformatted')
|
open (20, status='scratch', form='unformatted')
|
write (20) 8
|
write (20) 8
|
backspace (20)
|
backspace (20)
|
read (20) i
|
read (20) i
|
if (i .ne. 8) call abort
|
if (i .ne. 8) call abort
|
close (20)
|
close (20)
|
|
|
! PR libfortran/20471
|
! PR libfortran/20471
|
do n = 1, 10
|
do n = 1, 10
|
x(n) = sqrt(real(n))
|
x(n) = sqrt(real(n))
|
end do
|
end do
|
open (3, form='unformatted', status='scratch')
|
open (3, form='unformatted', status='scratch')
|
write (3) (x(n),n=1,10)
|
write (3) (x(n),n=1,10)
|
backspace (3)
|
backspace (3)
|
rewind (3)
|
rewind (3)
|
read (3) (y(n),n=1,10)
|
read (3) (y(n),n=1,10)
|
|
|
do n = 1, 10
|
do n = 1, 10
|
if (abs(x(n)-y(n)) > 0.00001) call abort
|
if (abs(x(n)-y(n)) > 0.00001) call abort
|
end do
|
end do
|
close (3)
|
close (3)
|
|
|
! PR libfortran/20156
|
! PR libfortran/20156
|
open (3, form='unformatted', status='scratch')
|
open (3, form='unformatted', status='scratch')
|
do i = 1, 5
|
do i = 1, 5
|
x(1) = i
|
x(1) = i
|
write (3) n, (x(n),n=1,10)
|
write (3) n, (x(n),n=1,10)
|
end do
|
end do
|
nr = 0
|
nr = 0
|
rewind (3)
|
rewind (3)
|
20 continue
|
20 continue
|
read (3,end=30,err=90) n, (x(n),n=1,10)
|
read (3,end=30,err=90) n, (x(n),n=1,10)
|
nr = nr + 1
|
nr = nr + 1
|
goto 20
|
goto 20
|
30 continue
|
30 continue
|
if (nr .ne. 5) call abort
|
if (nr .ne. 5) call abort
|
|
|
do i = 1, nr+1
|
do i = 1, nr+1
|
backspace (3)
|
backspace (3)
|
end do
|
end do
|
|
|
do i = 1, nr
|
do i = 1, nr
|
read(3,end=70,err=90) n, (x(n),n=1,10)
|
read(3,end=70,err=90) n, (x(n),n=1,10)
|
if (abs(x(1) - i) .gt. 0.001) call abort
|
if (abs(x(1) - i) .gt. 0.001) call abort
|
end do
|
end do
|
close (3)
|
close (3)
|
stop
|
stop
|
|
|
70 continue
|
70 continue
|
call abort
|
call abort
|
90 continue
|
90 continue
|
call abort
|
call abort
|
|
|
end
|
end
|
|
|