Unformatted file size limit?

Tobias Burnus burnus@net-b.de
Mon Nov 30 17:52:00 GMT 2009


On 11/30/2009 04:38 PM, Manuel Gimond wrote:
> I don't encounter the error when the file size ends up being less than 2GB. Is the 2GB limit intentionally set?
>   

Kind of. There several years ago, one has created operating systems /
system libraries with 32bit variables for the position in the file.
Depending whether one needs a signed or unsigned variable, that means
that one can only address single bytes withing a range of 2 or 4
gigabytes. Several years later, the hard disks had grown large enough to
worry about files > 2 GB. Thus, the file-position variable had been
doubled to 64bit (Files with 8191 Petabyte must be large enough ...).
However, due to backward compatibility, the 64bit version is not used by
default.

For several systems (Linux, Cygwin, AIX, ...) it is enough to define
_LARGE_FILES when compiling. However, for MinGW (versions for 32 and 64
bit Windows) one needs to use off64_t, ftello64, seeko64 explicitly,
which is currently not done in libgfortran.

See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40812

Tobias



More information about the Fortran mailing list