aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2020-05-26 21:21:19 +0200
committerHarald Anlauf <anlauf@gmx.de>2020-05-26 21:33:46 +0200
commit8d8a25b0a7c3400c724e04e1d775d9f377216c04 (patch)
treeca5b63b0656c0b392daf57f8171abf6887bee369 /gcc
parent73655feb9d44829ce2153f4f5eacc37a6268ce73 (diff)
downloadgcc-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 'gcc')
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_97.f9014
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/namelist_97.f90 b/gcc/testsuite/gfortran.dg/namelist_97.f90
new file mode 100644
index 0000000..4907e46
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/namelist_97.f90
@@ -0,0 +1,14 @@
+! { dg-do run }
+! { dg-output "At line 12 .*" }
+! { dg-shouldfail "Fortran runtime error: Namelist formatting .* FORM='UNFORMATTED'" }
+!
+! PR95195 - improve runtime error when writing a namelist to an unformatted file
+
+program test
+ character(len=11) :: my_form = 'unformatted'
+ integer :: i = 1, j = 2, k = 3
+ namelist /nml1/ i, j, k
+ open (unit=10, file='test.dat', form=my_form)
+ write (unit=10, nml=nml1)
+ close (unit=10, status='delete')
+end program test