diff options
author | Harald Anlauf <anlauf@gmx.de> | 2020-05-26 21:21:19 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2020-05-26 21:33:46 +0200 |
commit | 8d8a25b0a7c3400c724e04e1d775d9f377216c04 (patch) | |
tree | ca5b63b0656c0b392daf57f8171abf6887bee369 /libgfortran | |
parent | 73655feb9d44829ce2153f4f5eacc37a6268ce73 (diff) | |
download | gcc-8d8a25b0a7c3400c724e04e1d775d9f377216c04.zip gcc-8d8a25b0a7c3400c724e04e1d775d9f377216c04.tar.gz gcc-8d8a25b0a7c3400c724e04e1d775d9f377216c04.tar.bz2 |
PR libfortran/95195 - improve runtime error for namelist i/o to unformatted file
Namelist input/output to unformatted files is prohibited.
Generate useful runtime errors instead instead of misleading ones.
2020-05-26 Harald Anlauf <anlauf@gmx.de>
libgfortran/
PR fortran/95195
* io/transfer.c (finalize_transfer): Generate runtime error for
namelist input/output to unformatted file.
gcc/testsuite/
PR fortran/95195
* gfortran.dg/namelist_97.f90: New test.
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/io/transfer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index b8db47d..d071c1c 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -4123,6 +4123,14 @@ finalize_transfer (st_parameter_dt *dtp) if ((dtp->u.p.ionml != NULL) && (cf & IOPARM_DT_HAS_NAMELIST_NAME) != 0) { + if (dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED) + { + generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT, + "Namelist formatting for unit connected " + "with FORM='UNFORMATTED"); + return; + } + dtp->u.p.namelist_mode = 1; if ((cf & IOPARM_DT_NAMELIST_READ_MODE) != 0) namelist_read (dtp); |