Commit 90eeab20 by Jerry DeLisle

re PR libfortran/70684 (incorrect reading of values from file on Windows)

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.

From-SVN: r235220
parent 218e9dde
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
......
! { 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
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>
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment