re PR libfortran/18284 (BACKSPACE broken)

2004-12-02  Bud Davis  <bdavis9659@comcast.net>

        PR libfortran/18284
        * io/unix.c (fd_alloc_w_at): Update file_length when extending.
        * io/backspace.c (formatted_backspace): Reset endfile after backspace.

        PR fortran/18284
        * gfortran.dg/backspace.f90

From-SVN: r91612
This commit is contained in:
Bud Davis 2004-12-02 04:29:00 +00:00 committed by Bud Davis
parent f177a08700
commit 78579b601d
5 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2004-12-02 Bud Davis <bdavis9659@comcast.net>
PR fortran/18284
* gfortran.dg/backspace.f90
2004-12-02 Bud Davis <bdavis9659@comcast.net> 2004-12-02 Bud Davis <bdavis9659@comcast.net>
* gfortran.dg/inquire.f90: New test. * gfortran.dg/inquire.f90: New test.

View File

@ -0,0 +1,11 @@
! { dg-do run }
!pr18284 BACKSPACE broken
open(unit=10,access='SEQUENTIAL',status='SCRATCH')
do I = 1,200
write(10,*)I
end do
backspace(10)
backspace(10)
read(10,*)I
if (I.NE.199) call abort
end

View File

@ -1,3 +1,9 @@
2004-12-02 Bud Davis <bdavis9659@comcast.net>
PR libfortran/18284
* io/unix.c (fd_alloc_w_at): Update file_length when extending.
* io/backspace.c (formatted_backspace): Reset endfile after backspace.
2004-12-02 Bud Davis <bdavis9659@comcast.net> 2004-12-02 Bud Davis <bdavis9659@comcast.net>
* io/inquire.c (inquire_via_unit): do not allow a direct access * io/inquire.c (inquire_via_unit): do not allow a direct access

View File

@ -77,6 +77,7 @@ done:
if (sseek (current_unit->s, base) == FAILURE) if (sseek (current_unit->s, base) == FAILURE)
goto io_error; goto io_error;
current_unit->last_record--; current_unit->last_record--;
current_unit->endfile = NO_ENDFILE;
return; return;

View File

@ -462,6 +462,9 @@ fd_alloc_w_at (unix_stream * s, int *len, gfc_offset where)
s->logical_offset = where + *len; s->logical_offset = where + *len;
if (where + *len > s->file_length)
s->file_length = where + *len;
n = s->logical_offset - s->buffer_offset; n = s->logical_offset - s->buffer_offset;
if (n > s->active) if (n > s->active)
s->active = n; s->active = n;