2013-03-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 31 Mar 2013 20:37:19 +0000 (20:37 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 31 Mar 2013 20:37:19 +0000 (20:37 +0000)
PR fortran/56786
* gfortran.dg/namelist_81.f90:  New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197291 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/namelist_81.f90 [new file with mode: 0644]

index a152083..48bebd0 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-31  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/56786
+       * gfortran.dg/namelist_81.f90:  New test.
+
 2013-03-30  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        * gfortran.dg/character_comparison_3.f90:  Adjust for use of memcmp
diff --git a/gcc/testsuite/gfortran.dg/namelist_81.f90 b/gcc/testsuite/gfortran.dg/namelist_81.f90
new file mode 100644 (file)
index 0000000..ddb100b
--- /dev/null
@@ -0,0 +1,43 @@
+! { dg-do run }
+! PR56786 Error on embedded spaces
+integer :: i(3)
+namelist /nml/ i
+
+i = -42
+open(99,status='scratch')
+write(99,'(a)') '&nml i(3 ) = 5 /'
+rewind(99)
+read(99,nml=nml)
+close(99)
+if (i(1)/=-42 .or. i(2)/=-42 .or. i(3)/=5) call abort()
+
+! Shorten the file so the read hits EOF
+
+open(99,status='scratch')
+write(99,'(a)') '&nml i(3 ) = 5 '
+rewind(99)
+read(99,nml=nml, end=30)
+call abort()
+! Shorten some more
+ 30 close(99)
+open(99,status='scratch')
+write(99,'(a)') '&nml i(3 ) ='
+rewind(99)
+read(99,nml=nml, end=40)
+call abort()
+! Shorten some more
+ 40 close(99)
+open(99,status='scratch')
+write(99,'(a)') '&nml i(3 )'
+rewind(99)
+read(99,nml=nml, end=50)
+call abort()
+! Shorten some more
+ 50 close(99)
+open(99,status='scratch')
+write(99,'(a)') '&nml i(3 '
+rewind(99)
+read(99,nml=nml, end=60)
+call abort()
+ 60 close(99)
+end