[Bug fortran/53796] I/O INQUIRE of RECL: If not specified in OPEN, the default value should be returned (sequential access)

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 28 15:42:00 GMT 2012


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-28 15:42:32 UTC ---
For comparison, for formatted and unformatted sequential, I get the following
result with different compilers:

NAG f95: 1024  / unformatted: 65536
Crayftn: 1024 / -1 (with int64 variable: 9223372036854775807)
g95:     1000000000 / 1000000000
ifort     132 / 510
PGI      -14920 (with int64 variable: 140737488340408) / as formatted
gfortran -1 / -1

When exceeding an explicitly given RECL=:
NAG f95:  Buffer overflow on output
g95:      Writing more data than the record size (RECL)
gfortran: End of record
ifort:    no error - but starts new record after recl is exceeded*
crayftn:  as ifort
pgi:      no error - but a single record*
* For formatted; writing a longer string to unformatted will yield a single
record.

 * * * 

gfortran has:

./libgfortran.h:#define DEFAULT_RECL 1073741824

which gets used with

./runtime/environ.c:  {"GFORTRAN_DEFAULT_RECL", DEFAULT_RECL,
&options.default_recl,

and in io/unit.c's init_units for stdin, stdout and stderr. Others get set via
io/open.c's new_unit: u->recl = opp->recl_in;


And in transfer, one finds code like:

          /* For preconnected units with default record length, set bytes left
             to unit record length and proceed, otherwise error.  */
           ...
                      && dtp->u.p.current_unit->recl == DEFAULT_RECL))
            dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;



More information about the Gcc-bugs mailing list