This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch for fortran pr18184 backspace is broken


On Tue, 2004-11-09 at 21:03, Paul Brook wrote:
  
> 
> This looks wrong. Shouldn't the fd_* routines take care of this?
> Maybe we should be updating s->file_length in fd_alloc_w_at, not fd_flush.
> 
> Paul

how about this ?  Tested i686/gnu/linux.

--bud


Index: gcc/libgfortran/io/backspace.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/backspace.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 backspace.c
*** gcc/libgfortran/io/backspace.c	9 Jun 2004 00:55:04 -0000	1.5
--- gcc/libgfortran/io/backspace.c	24 Nov 2004 21:30:34 -0000
*************** done:
*** 77,82 ****
--- 77,83 ----
    if (sseek (current_unit->s, base) == FAILURE)
      goto io_error;
    current_unit->last_record--;
+   current_unit->endfile = NO_ENDFILE;
  
    return;
  
Index: gcc/libgfortran/io/unix.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/unix.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 unix.c
*** gcc/libgfortran/io/unix.c	30 Oct 2004 16:23:23 -0000	1.13
--- gcc/libgfortran/io/unix.c	24 Nov 2004 21:30:34 -0000
*************** fd_alloc_w_at (unix_stream * s, int *len
*** 463,468 ****
--- 463,471 ----
  
    s->logical_offset = where + *len;
  
+   if (where + *len > s->file_length)
+     s->file_length = where + *len;
+ 
    n = s->logical_offset - s->buffer_offset;
    if (n > s->active)
      s->active = n;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]