diff options
author | Bud Davis <bdavis9659@comcast.net> | 2004-07-05 01:19:08 +0000 |
---|---|---|
committer | Bud Davis <bdavis@gcc.gnu.org> | 2004-07-05 01:19:08 +0000 |
commit | bf1df0a046ed0a4d272d0ee2c2a930e3ad9d1831 (patch) | |
tree | b268954c8950b71cc4b9784da0d2cc8172c33fc5 /gcc | |
parent | 91a8b4596b7555f113eef0097a573ad24bdc17db (diff) | |
download | gcc-bf1df0a046ed0a4d272d0ee2c2a930e3ad9d1831.zip gcc-bf1df0a046ed0a4d272d0ee2c2a930e3ad9d1831.tar.gz gcc-bf1df0a046ed0a4d272d0ee2c2a930e3ad9d1831.tar.bz2 |
re PR libfortran/15472 (implicit open for unformatted file causes run-time error)
2004-07-04 Bud Davis <bdavis9659@comcast.net>
Paul Brook <paul@codesourcery.com>
PR fortran/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): handle requests at start, fd_flush at
right time.
* io/unix.c(is_seekable): set based upon the file/device, not the
method being used to access it (fd or mmap).
* io/unix.c(fd_flush): don't set file_size if !seekable.
* io/unix.c(fd_truncate: ditto.
* gfortran.fortran-torture/execute/seq_io.f90: New test.
Co-Authored-By: Paul Brook <paul@codesourcery.com>
From-SVN: r84104
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.fortran-torture/execute/seq_io.f90 | 81 |
2 files changed, 85 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f03b45..b90f61d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-07-04 Bud Davis <bdavis9659@comcast.net> + + * gfortran.fortran-torture/execute/seq_io.f90: New test. + 2004-07-04 Neil Booth <neil@duron.akihabara.co.uk> * gcc.dg/cpp/if-mop.c: Two new testcases. diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/seq_io.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/seq_io.f90 new file mode 100644 index 0000000..e168888 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/seq_io.f90 @@ -0,0 +1,81 @@ +! pr 15472 +! sequential access files +! +! this test verifies the most basic sequential unformatted I/O +! write 3 records of various sizes +! then read them back +! and compare with what was written +! + implicit none + integer size + parameter(size=100) + logical debug + data debug /.FALSE./ +! set debug to true for help in debugging failures. + integer m(2) + integer n + real*4 r(size) + integer i + m(1) = Z'11111111' + m(2) = Z'22222222' + n = Z'33333333' + do i = 1,size + r(i) = i + end do + write(9)m ! an array of 2 + write(9)n ! an integer + write(9)r ! an array of reals +! zero all the results so we can compare after they are read back + do i = 1,size + r(i) = 0 + end do + m(1) = 0 + m(2) = 0 + n = 0 + + rewind(9) + read(9)m + read(9)n + read(9)r +! +! check results + if (m(1).ne.Z'11111111') then + if (debug) then + print '(A,Z8)','m(1) incorrect. m(1) = ',m(1) + else + call abort + endif + endif + + if (m(2).ne.Z'22222222') then + if (debug) then + print '(A,Z8)','m(2) incorrect. m(2) = ',m(2) + else + call abort + endif + endif + + if (n.ne.Z'33333333') then + if (debug) then + print '(A,Z8)','n incorrect. n = ',n + else + call abort + endif + endif + + do i = 1,size + if (int(r(i)).ne.i) then + if (debug) then + print*,'element ',i,' was ',r(i),' should be ',i + else + call abort + endif + endif + end do +! use hexdump to look at the file "fort.9" + if (debug) then + close(9) + else + close(9,status='DELETE') + endif + end |