diff options
author | Bud Davis <bdavis9659@comcast.net> | 2004-11-28 21:14:02 +0000 |
---|---|---|
committer | Bud Davis <bdavis@gcc.gnu.org> | 2004-11-28 21:14:02 +0000 |
commit | 905d47a9507cc15446a517fce0aa050344fdeb53 (patch) | |
tree | 89d7f6bc7734d8a3ecf12aac0f4cbe7e31547a34 | |
parent | 856e49c207daeb5ef0d24e43e432f6215b24ef33 (diff) | |
download | gcc-905d47a9507cc15446a517fce0aa050344fdeb53.zip gcc-905d47a9507cc15446a517fce0aa050344fdeb53.tar.gz gcc-905d47a9507cc15446a517fce0aa050344fdeb53.tar.bz2 |
direct_io_2.f90: New test.
2004-11-28 Bud Davis <bdavis9659@comcast.net>
* gcc/gcc/gfortran.dg/direct_io_2.f90: New test.
* gcc/libgfortran/io/unix.c (mmap_alloc_w_a): check for a write
to a location less than the mapped area.
From-SVN: r91426
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/direct_io_2.f90 | 44 | ||||
-rw-r--r-- | libgfortran/ChangeLog | 5 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 3 |
4 files changed, 55 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2f203ae..7de43cf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-11-28 Bud Davis <bdavis9659@comcast.net> + + * gfortran.dg/direct_io_2.f90: New test. + 2004-11-28 Hans-Peter Nilsson <hp@bitrange.com> PR target/18334 diff --git a/gcc/testsuite/gfortran.dg/direct_io_2.f90 b/gcc/testsuite/gfortran.dg/direct_io_2.f90 new file mode 100644 index 0000000..847ce29 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/direct_io_2.f90 @@ -0,0 +1,44 @@ +! { dg-do run } +! +! this testcase derived from NIST test FM413.FOR +! tests writing direct access files in ascending and descending +! REC's. + PROGRAM FM413 + IMPLICIT LOGICAL (L) + IMPLICIT CHARACTER*14 (C) + OPEN (7, ACCESS = 'DIRECT', RECL = 80, STATUS='REPLACE' ) + IRECN = 13 + IREC = 13 + DO 4132 I = 1,100 + IREC = IREC + 2 + IRECN = IRECN + 2 + WRITE(7, REC = IREC) IPROG, IFILE, ITOTR, IRLGN, IRECN, IEOF,ICON21, ICON22, ICON31, ICON32, ICON33, ICON34, ICON55, ICON56 + 4132 CONTINUE + IRECN = 216 + IREC = 216 + DO 4133 I=1,100 + IREC = IREC - 2 + IRECN = IRECN - 2 + WRITE(7, REC = IREC) IPROG, IFILE, ITOTR, IRLGN, IRECN, IEOF,ICON21, ICON22, ICON31, ICON32, ICON33, ICON34, ICON55, ICON56 + 4133 CONTINUE + IRECCK = 13 + IRECN = 0 + IREC = 13 + IVCOMP = 0 + DO 4134 I = 1,100 + IREC = IREC + 2 + IRECCK = IRECCK + 2 + READ(7, REC = IREC) IPROG, IFILE, ITOTR, IRLGN, IRECN, IEOF,IVON21, IVON22, IVON31, IVON32, IVON33, IVON34, IVON55, IVON56 + IF (IRECN .NE. IRECCK) CALL ABORT + 4134 CONTINUE + IRECCK = 216 + IRECN = 0 + IREC = 216 + DO 4135 I = 1,100 + IREC = IREC - 2 + IRECCK = IRECCK - 2 + READ(7, REC = IREC) IPROG, IFILE, ITOTR, IRLGN, IRECN, IEOF,IVON21, IVON22, IVON31, IVON32, IVON33, IVON34, IVON55, IVON56 + IF (IRECN .NE. IRECCK) CALL ABORT + 4135 CONTINUE + STOP + END diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index a27c75d..761ec22 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2004-11-28 Bud Davis <bdavis9659@comcast.net> + + * io/unix.c (mmap_alloc_w_a): check for a write to a location + less than the mapped area. + 2004-11-27 Bud Davis <bdavis9659@comcast.net> PR fortran/18364 diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 45d8cfd..2e9d9a4 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -667,7 +667,8 @@ mmap_alloc_w_at (unix_stream * s, int *len, gfc_offset where) } if ((s->buffer == NULL || s->buffer_offset > where || - where + *len > s->buffer_offset + s->active) && + where + *len > s->buffer_offset + s->active || + where < s->buffer_offset + s->active) && mmap_alloc (s, where, len) == FAILURE) return NULL; |