aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2023-05-12 13:38:25 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2023-05-12 13:40:42 -0700
commit96cc09dea48b562a0fc93d43fb3b702ac20b89fd (patch)
treebd44c2dfb4b4d796ecefd3f8afda399528bac6d4 /gcc
parentcf3b032b8fb681516ccacbe3689f1cad43a1773a (diff)
downloadgcc-96cc09dea48b562a0fc93d43fb3b702ac20b89fd.zip
gcc-96cc09dea48b562a0fc93d43fb3b702ac20b89fd.tar.gz
gcc-96cc09dea48b562a0fc93d43fb3b702ac20b89fd.tar.bz2
Fortran: Revise a namelist test case.
PR fortran/109662 gcc/testsuite/ChangeLog: * gfortran.dg/pr109662-a.f90: Add a section to verify that a short namelist read does not modify the variable.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gfortran.dg/pr109662-a.f9021
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr109662-a.f90 b/gcc/testsuite/gfortran.dg/pr109662-a.f90
index 0059df2..dc05d6b 100644
--- a/gcc/testsuite/gfortran.dg/pr109662-a.f90
+++ b/gcc/testsuite/gfortran.dg/pr109662-a.f90
@@ -3,13 +3,26 @@
! PR109662-a semi-colon after namelist name accepted on input.
program testnmlread
implicit none
- character(16) :: list = '&stuff; n = 759/'
+ character(16) :: line = '&stuff; n = 759/'
character(100)::message
- integer :: n, ioresult
+ integer :: n, i, ioresult
namelist/stuff/n
message = ""
ioresult = 0
n = 99
- read(list,nml=stuff,iostat=ioresult)
- if (ioresult == 0) STOP 13
+ read(line,nml=stuff,iostat=ioresult)
+ if (ioresult == 0) STOP 13 ! Should error with the semi-colon in there.
+
+ ! Intentional short input (-> EOF)
+ line = "&stuff"
+ ! Problem manifests on two bad reads on same string.
+ do i = 1, 6
+ n = -1
+ ioresult = 0
+
+ read (line,nml=stuff,iostat=ioresult)
+ if (n /= -1) STOP 24
+ if (ioresult == 0) STOP 25
+ end do
+
end program testnmlread