Skip to content
Snippets Groups Projects
Commit 75152bcb authored by Jerry DeLisle's avatar Jerry DeLisle
Browse files

re PR fortran/41328 (bad iostat when reading DOS file in a character array (non-advancing))

2009-09-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/41328
	* gfortran.dg/cr_lf.f90: New test.

From-SVN: r151666
parent ee3eb6a4
No related branches found
No related tags found
No related merge requests found
2009-09-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/41328
* gfortran.dg/cr_lf.f90: New test.
2009-09-11 Michael Matz <matz@suse.de> 2009-09-11 Michael Matz <matz@suse.de>
PR middle-end/41275 PR middle-end/41275
......
! { dg-do run }
! { dg-options "-fbackslash" }
! PR41328 and PR41168 Improper read of CR-LF sequences.
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program main
implicit none
integer :: iostat, n_chars_read
character(len=1) :: buffer(64) = ""
open( unit=10, form="formatted", access="stream", status="scratch")
write(10, fmt="(a)", advance="no") "a\rb\rc\r"
rewind(10)
read( unit=10, fmt='(64A)', advance='NO', iostat=iostat, &
size=n_chars_read ) buffer
if (n_chars_read.ne.1) call abort
if (any(buffer(1:n_chars_read).ne."a")) call abort
if (.not.is_iostat_eor(iostat)) call abort
read( unit=10, fmt='(64A)', advance='NO', iostat=iostat, &
size=n_chars_read ) buffer
if (n_chars_read.ne.1) call abort
if (any(buffer(1:n_chars_read).ne."b")) call abort
if (.not.is_iostat_eor(iostat)) call abort
read( unit=10, fmt='(64A)', advance='NO', iostat=iostat, &
size=n_chars_read ) buffer
if (n_chars_read.ne.1) call abort
if (any(buffer(1:n_chars_read).ne."c")) call abort
if (.not.is_iostat_eor(iostat)) call abort
read( unit=10, fmt='(64A)', advance='NO', iostat=iostat, &
size=n_chars_read ) buffer
if (n_chars_read.ne.0) call abort
if (any(buffer(1:n_chars_read).ne."a")) call abort
if (.not.is_iostat_end(iostat)) call abort
end program main
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment