2412750e79
It turns out that Linux never reads or writes more than 2147479552 bytes in a single syscall. For writes this is not a problem as libgfortran already contains a loop around write() to handle short writes. But for reads we cannot do this, since then read will hang if we have a short read when reading from the terminal. Also, there are reports that macOS fails I/O's larger than 2 GB. Thus, to work around these issues do large reads/writes in chunks. The testcase from the PR program largewr integer(kind=1) :: a(2_8**31+1) a = 0 a(size(a, kind=8)) = 1 open(10, file="largewr.dat", access="stream", form="unformatted") write (10) a close(10) a(size(a, kind=8)) = 2 open(10, file="largewr.dat", access="stream", form="unformatted") read (10) a if (a(size(a, kind=8)) == 1) then print *, "All is well" else print *, "Oh no" end if end program largewr fails on trunk but works with the patch. Regtested on x86_64-pc-linux-gnu, committed to trunk. libgfortran/ChangeLog: 2018-01-02 Janne Blomqvist <jb@gcc.gnu.org> PR libgfortran/83649 * io/unix.c (MAX_CHUNK): New define. (raw_read): For reads larger than MAX_CHUNK, loop. (raw_write): Write no more than MAX_CHUNK bytes per iteration. From-SVN: r256074 |
||
---|---|---|
.. | ||
caf | ||
config | ||
generated | ||
ieee | ||
intrinsics | ||
io | ||
m4 | ||
runtime | ||
acinclude.m4 | ||
aclocal.m4 | ||
c99_protos.h | ||
ChangeLog | ||
ChangeLog-2002 | ||
ChangeLog-2003 | ||
ChangeLog-2004 | ||
ChangeLog-2005 | ||
ChangeLog-2006 | ||
ChangeLog-2007 | ||
ChangeLog-2008 | ||
ChangeLog-2009 | ||
ChangeLog-2010 | ||
ChangeLog-2011 | ||
ChangeLog-2012 | ||
ChangeLog-2013 | ||
ChangeLog-2014 | ||
ChangeLog-2015 | ||
ChangeLog-2016 | ||
config.h.in | ||
configure | ||
configure.ac | ||
configure.host | ||
gfortran.map | ||
kinds-override.h | ||
libgfortran.h | ||
libgfortran.spec.in | ||
libtool-version | ||
Makefile.am | ||
Makefile.in | ||
mk-kinds-h.sh | ||
mk-sik-inc.sh | ||
mk-srk-inc.sh |