libgfortran/io/io.h defines the "struct st_parameter_open" with GFC_INTEGER_4 recl_in; However, the Fortran 95/2003/2008 standard allows any kind of integer expression and not only the default type. As http://gcc.gnu.org/ml/fortran/2010-05/msg00302.html shows, gfortran currently fails if the RECL= is larger than 2 GB. Expected: The size is increased to GFC_INTEGER_8 to allow large-record access. See also http://gcc.gnu.org/wiki/LibgfortranAbiCleanup
Confirmed.
I would like to work this one.
I have managed a patch that writes one very big record as in the test case. I don't have sufficient memory to actually test a read. It should be noted that the record length stored in gfc_unit which is created at runtime is a 64 bit value already. The front-end changes needed to support large record lengths is almost trivial. On the library side, writing is fairly simple as well. Reading is a little bit more complicated. Hopefully soon I will post a partial patch (or maybe even a complete but untested one) I know Steve has a machine with lots of RAM, is there anyone else who would like to help with testing this?
See also: PR 29602
Hi Jerry, should we also look at this when we bump the library number?
(In reply to Thomas Koenig from comment #5) > Hi Jerry, > > should we also look at this when we bump the library number? Sure, but I will have to start over to find the places since things have moved around.
I have a functioning patch, will post shortly.
Patch: https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01563.html
Author: jb Date: Sat Nov 18 16:13:20 2017 New Revision: 254915 URL: https://gcc.gnu.org/viewcvs?rev=254915&root=gcc&view=rev Log: PR 44292 Enable large record lengths in OPEN and INQUIRE statements This is a straightforward change that we can do now that the ABI has been bumped (again!). Regtested on x86_64-pc-linux-gnu. gcc/fortran/ChangeLog: 2017-11-18 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/44292 * ioparm.def (IOPARM): Make recl_in intio, and recl_out pintio. libgfortran/ChangeLog: 2017-11-18 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/44292 * io/io.h: Make recl_in a GC_IO_INT and recl_out a type GFC_IO_INT*. gcc/testsuite/ChangeLog: 2017-11-18 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/44292 * gfortran.dg/large_recl.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/large_recl.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/ioparm.def trunk/gcc/testsuite/ChangeLog trunk/libgfortran/ChangeLog trunk/libgfortran/io/io.h
Follow-up patch: https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01646.html
Author: jb Date: Sat Nov 18 22:05:13 2017 New Revision: 254918 URL: https://gcc.gnu.org/viewcvs?rev=254918&root=gcc&view=rev Log: PR 44292 Handle large record lengths Now that the ABI supports large record lengths, there's a few places in libgfortran where we need to use larger types. For internal units which by definition are in-memory, it's enought to use ptrdiff_t, for external units gfc_offset. Regtested on x86_64-pc-linux-gnu? libgfortran/ChangeLog: 2017-11-19 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/44292 * io/transfer.c (skip_record): Use gfc_offset to handle large records. (next_record_r): Likewise. (sset): Likewise. (next_record_w): Use gfc_offset/ptrdiff_t appropriately. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/transfer.c
Fixed on trunk, closing. There might still be uses of 32-bit integers for record lengths in the library (if so, file a new bug or reopen this one), but the ABI issue and at least the most obvious internal usage should now be fixed.