The current F2018 draft (N2137) specifies behavior of the RECL= specifier in the INQUIRE statement, where it previously was left as undefined. Namely: - If the unit is not connected, RECL= should be given the value -1. - If the unit is connected with stream access, RECL= should be given the value -2. Further, as PR 53796 describes, the handling of RECL= is poor in other ways as well. When the recl is set to the maximum possible (GFC_INTEGER_8_HUGE / LLONG_MAX), which it does by default except for preconnected units, and when INQUIRE(RECL=) is used with a 4 byte integer, the value is truncated and the 4 byte value is thus -1. Fixing this to generate an error is a lot of work, as currently the truncation is done by the frontend, the library sees only an 8 byte value with no indication that the frontend is going to copy it to a 4 byte one. Instead, this patch does a bit twiddling trick such that the truncated 4 byte value is GFC_INTEGER_4_HUGE while still being 0.99999999 * GFC_INTEGER_8_HUGE which is large enough for all practical purposes. Finally, the patch removes GFORTRAN_DEFAULT_RECL which was used only for preconnected units, and instead uses the same approach as describe above. Regtested on x86_64-pc-linux-gnu, Ok for trunk. gcc/fortran/ChangeLog: 2017-11-28 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53796 * gfortran.texi: Remove mentions of GFORTRAN_DEFAULT_RECL. libgfortran/ChangeLog: 2017-11-28 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53796 * io/inquire.c (inquire_via_unit): Set recl to -1 for unconnected units. * io/io.h (default_recl): New variable. * io/open.c (new_unit): Set recl to default_recl for sequential, -2 for stream access. * io/transfer.c (read_block_form): Test against default_recl instead of DEFAULT_RECL. (write_block): Likewise. * io/unit.c (init_units): Calculate max_offset, default_recl. * libgfortran.h (DEFAULT_RECL): Remove. * runtime/environ.c: Remove GFORTRAN_DEFAULT_RECL. gcc/testsuite/ChangeLog: 2017-11-28 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/53796 * gfortran.dg/inquire_recl_f2018.f90: New test. From-SVN: r255215
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| ChangeLog | Loading commit data... | |
| ChangeLog-2002 | Loading commit data... | |
| ChangeLog-2003 | Loading commit data... | |
| ChangeLog-2004 | Loading commit data... | |
| ChangeLog-2005 | Loading commit data... | |
| ChangeLog-2006 | Loading commit data... | |
| ChangeLog-2007 | Loading commit data... | |
| ChangeLog-2008 | Loading commit data... | |
| ChangeLog-2009 | Loading commit data... | |
| ChangeLog-2010 | Loading commit data... | |
| ChangeLog-2011 | Loading commit data... | |
| ChangeLog-2012 | Loading commit data... | |
| ChangeLog-2013 | Loading commit data... | |
| ChangeLog-2014 | Loading commit data... | |
| ChangeLog-2015 | Loading commit data... | |
| ChangeLog-2016 | Loading commit data... | |
| ChangeLog.ptr | Loading commit data... | |
| Make-lang.in | Loading commit data... | |
| arith.c | Loading commit data... | |
| arith.h | Loading commit data... | |
| array.c | Loading commit data... | |
| bbt.c | Loading commit data... | |
| check.c | Loading commit data... | |
| class.c | Loading commit data... | |
| config-lang.in | Loading commit data... | |
| constructor.c | Loading commit data... | |
| constructor.h | Loading commit data... | |
| convert.c | Loading commit data... | |
| cpp.c | Loading commit data... | |
| cpp.h | Loading commit data... | |
| data.c | Loading commit data... | |
| data.h | Loading commit data... | |
| decl.c | Loading commit data... | |
| dependency.c | Loading commit data... | |
| dependency.h | Loading commit data... | |
| dump-parse-tree.c | Loading commit data... | |
| error.c | Loading commit data... | |
| expr.c | Loading commit data... | |
| f95-lang.c | Loading commit data... | |
| frontend-passes.c | Loading commit data... | |
| gfc-diagnostic.def | Loading commit data... | |
| gfc-internals.texi | Loading commit data... | |
| gfortran.h | Loading commit data... | |
| gfortran.texi | Loading commit data... | |
| gfortranspec.c | Loading commit data... | |
| interface.c | Loading commit data... | |
| intrinsic.c | Loading commit data... | |
| intrinsic.h | Loading commit data... | |
| intrinsic.texi | Loading commit data... | |
| invoke.texi | Loading commit data... | |
| io.c | Loading commit data... | |
| ioparm.def | Loading commit data... | |
| iresolve.c | Loading commit data... | |
| iso-c-binding.def | Loading commit data... | |
| iso-fortran-env.def | Loading commit data... | |
| lang-specs.h | Loading commit data... | |
| lang.opt | Loading commit data... | |
| libgfortran.h | Loading commit data... | |
| match.c | Loading commit data... | |
| match.h | Loading commit data... | |
| matchexp.c | Loading commit data... | |
| mathbuiltins.def | Loading commit data... | |
| misc.c | Loading commit data... | |
| module.c | Loading commit data... | |
| openmp.c | Loading commit data... | |
| options.c | Loading commit data... | |
| parse.c | Loading commit data... | |
| parse.h | Loading commit data... | |
| primary.c | Loading commit data... | |
| resolve.c | Loading commit data... | |
| scanner.c | Loading commit data... | |
| scanner.h | Loading commit data... | |
| simplify.c | Loading commit data... | |
| st.c | Loading commit data... | |
| symbol.c | Loading commit data... | |
| target-memory.c | Loading commit data... | |
| target-memory.h | Loading commit data... | |
| trans-array.c | Loading commit data... | |
| trans-array.h | Loading commit data... | |
| trans-common.c | Loading commit data... | |
| trans-const.c | Loading commit data... | |
| trans-const.h | Loading commit data... | |
| trans-decl.c | Loading commit data... | |
| trans-expr.c | Loading commit data... | |
| trans-intrinsic.c | Loading commit data... | |
| trans-io.c | Loading commit data... | |
| trans-openmp.c | Loading commit data... | |
| trans-stmt.c | Loading commit data... | |
| trans-stmt.h | Loading commit data... | |
| trans-types.c | Loading commit data... | |
| trans-types.h | Loading commit data... | |
| trans.c | Loading commit data... | |
| trans.h | Loading commit data... | |
| types.def | Loading commit data... |