[gfortran] patch for pr15472 and sequential unformatted I/O
Paul Brook
paul@codesourcery.com
Sun Jul 4 13:53:00 GMT 2004
> 2004-07-02 Bud Davis <bdavis9659@comcast.net>
>
> PR gfortran/15472
> * io/transfer.c(us_write): set recl for seq unform writes to max size.
> * io/transfer.c(data_transfer_init): handle un-opened seq unform unit.
> * io/unix.c(fd_alloc_w_at): deal with writes in the middle of the
> buffer.
> * io/unix.c(is_seekable): set based upon the file/device, not the
> method being used to access it (fd or mmap).
> Index: gcc/libgfortran/io/unix.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/libgfortran/io/unix.c,v
> retrieving revision 1.6
> diff -c -3 -p -r1.6 unix.c
> *** gcc/libgfortran/io/unix.c 26 Jun 2004 11:49:06 -0000 1.6
> --- gcc/libgfortran/io/unix.c 2 Jul 2004 04:11:32 -0000
> *************** fd_alloc_w_at (unix_stream * s, int *len
> *** 416,423 ****
> {
> if (s->dirty_offset + s->ndirty == where)
> s->ndirty += *len;
> else
> ! fd_flush (s); /* Can't combine two dirty blocks */
> }
>
> s->logical_offset = where + *len;
> --- 416,431 ----
> {
> if (s->dirty_offset + s->ndirty == where)
> s->ndirty += *len;
> + else if (where <= s->dirty_offset && where >= s->buffer_offset)
> + {
> + s->dirty_offset = where;
> + s->ndirty = s->ndirty ;
> + }
This looks wrong. We already know (where >= s->buffer_offset).
Also s->ndirty = s->ndirty; suggests there's something missing.
I guess this is intended to catch overlapping buffers. A comment would be
helpful :)
> + else if (where>s->dirty_offset && where < s->ndirty+s->dirty_offset)
> + ; /* right in the middle, do nothing */
I'm not convinced that this is correct either. What about when
(where + *len > s->dirty_offset + s->ndirty)
Paul
More information about the Fortran
mailing list