This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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 Thursday 04 November 2004 01:42, Bud Davis wrote:
> 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:

This is ok.

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

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


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