diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-19 19:24:28 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-19 19:24:28 +0000 |
commit | acda2210819fe7bf3b6bf3aefa29aaf84d735331 (patch) | |
tree | 69912d458025faceac8aac62606abc7afeff10c9 | |
parent | f60f68fd2b4e0bc80391358fc56f9facd6d0acf6 (diff) | |
download | gcc-acda2210819fe7bf3b6bf3aefa29aaf84d735331.tar.gz |
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.
* gfortran.dg/list_read_14.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235220 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/list_read_14.f90 | 25 | ||||
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 2 |
4 files changed, 37 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f97e63ec7c1..ed50f14795c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-19 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/70684 + * gfortran.dg/list_read_14.f90: New test. + 2016-04-19 H.J. Lu <hongjiu.lu@intel.com> PR target/69201 diff --git a/gcc/testsuite/gfortran.dg/list_read_14.f90 b/gcc/testsuite/gfortran.dg/list_read_14.f90 new file mode 100644 index 00000000000..15bcfad500d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/list_read_14.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! PR70684 incorrect reading of values from file on Windows +program test +implicit none +integer,parameter :: isize=12 +integer,parameter :: funit=12 +integer :: i +character(1), parameter :: cr=char(13) +double precision, dimension(isize) :: a, res +res= (/ 1.0000000000000000, 2.0000000000000000, 3.0000000000000000, & + 4.0000000000000000, 5.0000000000000000, 6.0000000000000000, & + 7.0000000000000000, 8.0000000000000000, 9.0000000000000000, & + 10.000000000000000, 11.000000000000000, 12.000000000000000 /) +do i=1,isize + a(i)=dble(i) +enddo +open(funit,status="scratch") +write(funit,'(1x,6(f25.20,'',''),a)') (a(i),i=1,6), cr +write(funit,'(1x,6(f25.20,'',''),a)') (a(i),i=7,12), cr +rewind(funit) +a=0d0 +read(funit,*) (a(i),i=1,isize) +close(funit) +if (any(a /= res)) call abort +end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 688a16e8d8b..6d16d644cd5 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +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> diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index e24b3922631..b8e174c5bd7 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -197,7 +197,7 @@ check_buffers (st_parameter_dt *dtp) } done: - dtp->u.p.at_eol = (c == '\n' || c == EOF); + dtp->u.p.at_eol = (c == '\n' || c == '\r' || c == EOF); return c; } |