This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch for fortran pr18184 backspace is broken
- From: Bud Davis <bdavis9659 at comcast dot net>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Wed, 03 Nov 2004 19:42:14 -0600
- Subject: patch for fortran pr18184 backspace is broken
No additional testsuite failures on i686/gnu/linux. Fixes NIST test
FM108.FOR.
--bud
!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
2004-11-04 Bud Davis <bdavis9659@comcast.net>
PR libfortran/18284
* io/unix.c (mmap_alloc_w_at): Update file_length when extending.
* io/backspace.c (formatted_backspace): Reset endfile after backspace.
Index: gcc/libgfortran/io/backspace.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/backspace.c,v
retrieving revision 1.5
diff -c -4 -p -r1.5 backspace.c
*** gcc/libgfortran/io/backspace.c 9 Jun 2004 00:55:04 -0000 1.5
--- gcc/libgfortran/io/backspace.c 3 Nov 2004 01:35:31 -0000
*************** formatted_backspace (void)
*** 76,83 ****
--- 76,84 ----
done:
if (sseek (current_unit->s, base) == FAILURE)
goto io_error;
current_unit->last_record--;
+ current_unit->endfile = NO_ENDFILE;
return;
io_error:
Index: gcc/libgfortran/io/unix.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/unix.c,v
retrieving revision 1.13
diff -c -4 -p -r1.13 unix.c
*** gcc/libgfortran/io/unix.c 30 Oct 2004 16:23:23 -0000 1.13
--- gcc/libgfortran/io/unix.c 3 Nov 2004 01:35:31 -0000
*************** mmap_alloc_w_at (unix_stream * s, int *l
*** 662,669 ****
--- 662,670 ----
if (where + *len > s->file_length)
{
if (s->mmaped)
mmap_flush (s);
+ s->file_length = s->file_length + *len;
return fd_alloc_w_at (s, len, where);
}
if ((s->buffer == NULL || s->buffer_offset > where ||