re PR libfortran/70684 (incorrect reading of values from file on Windows)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Tue, 24 May 2016 06:11:21 +0000 (06:11 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Tue, 24 May 2016 06:11:21 +0000 (06:11 +0000)
2016-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libgfortran/70684
* io/list_read (eat_spaces): Eat '\r' as part of spaces.

* gfortran.dg/namelist_90.f: New test

From-SVN: r236628

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/namelist_90.f [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/list_read.c

index 49789988c96d189bfa0fe7784e74df1cf62b6a1c..32e95227be29d55575ac08d8bf355a4a361b27d1 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/71123
+       * gfortran.dg/namelist_90.f: New test
+
 2016-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/66461
diff --git a/gcc/testsuite/gfortran.dg/namelist_90.f b/gcc/testsuite/gfortran.dg/namelist_90.f
new file mode 100644 (file)
index 0000000..9c0ae5b
--- /dev/null
@@ -0,0 +1,28 @@
+! { dg-do run }
+! PR71123 Namelist read failure on Windows 
+      implicit none
+      integer :: i, ierr
+      real(8), dimension(30) :: senid, res
+      character(2) :: crlf = char(13) // char(10)
+      namelist /fith/ senid
+      do i=1,30
+         res(i) = i
+      enddo
+      senid = 99.0
+      open(unit=7,file='test.out',form='formatted',
+     *         status='new',action='readwrite', access='stream')
+      write(7,'(a)') "&fith" // crlf
+      write(7,'(a)') "senid=  1.0 , 2.0 , 3.0 , 4.0  , 5.0 ," // crlf
+      write(7,'(a)') "6.0 , 7.0 ,  8.0 ,  9.0 ,  10.0 , 11.0 ," // crlf
+      write(7,'(a)') "12.0 , 13.0 , 14.0 , 15.0 , 16.0 , 17.0 ," // crlf
+      write(7,'(a)') "18.0 , 19.0 , 20.0 , 21.0 , 22.0 , 23.0 ," // crlf
+      write(7,'(a)') "24.0 , 25.0 , 26.0 , 27.0 , 28.0 , 29.0 ," // crlf
+      write(7,'(a)') "30.0 ," // crlf
+      write(7,'(a)') "/" // crlf
+      close(7)
+      open(unit=7,file='test.out',form='formatted')
+      read(7,nml=fith, iostat=ierr)
+      close(7, status="delete")
+      if (ierr.ne.0) call abort
+      if (any(senid.ne.res)) call abort
+      end
index 6d16d644cd5e1b53375ca43c72f3fb096c22f70b..549a5aa2a2ee25a54779632d4ebf5e80762138bf 100644 (file)
@@ -1,8 +1,12 @@
+2016-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/70684
+       * io/list_read (eat_spaces): Eat '\r' as part of spaces.
+
 2016-04-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/70684
        * io/list_read (check_buffers): Add '\r' to check for end of line.
-       factor.
 
 2016-03-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
            Dominique d'Humieres  <dominiq@lps.ens.fr>
index b8e174c5bd7955b44da66a5f043edcdee985a1a7..244430d9765bee1919eb26f585a02cba2a4c9ccc 100644 (file)
@@ -418,7 +418,7 @@ eat_spaces (st_parameter_dt *dtp)
   /* Now skip spaces, EOF and EOL are handled in next_char.  */
   do
     c = next_char (dtp);
-  while (c != EOF && (c == ' ' || c == '\t'));
+  while (c != EOF && (c == ' ' || c == '\r' || c == '\t'));
 
   unget_char (dtp, c);
   return c;