This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30435] Slash at end of input not recognized according to standard
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jan 2007 17:00:33 -0000
- Subject: [Bug fortran/30435] Slash at end of input not recognized according to standard
- References: <bug-30435-13164@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from kargl at gcc dot gnu dot org 2007-01-11 17:00 -------
The relevant section of the F2003 standard is 10.9.1.1.
It appears that in list-directed input that if we advance
to a newline during the read and the first item hit is a
/ when get it wrong. Here a test program.
program t
integer a, b, c, d
! This works as expected
open(unit=10, file='tmp.dat')
write(10,*) '1 2 3 / 4'
rewind(10)
a = -1; b = -1; c = -1; d = -1;
read(10,*) a,b,c,d
print *, a,b,c,d
! This works as expected
rewind(10)
write(10,*) '1 2 3 /'
rewind(10)
a = -2; b = -2; c = -2; d = -2;
read(10,*) a,b,c,d
print *, a,b,c,d
! This works as expected.
rewind(10)
write(10,*) '1 2'
write(10,*) '3 /'
rewind(10)
a = -3; b = -3; c = -3; d = -3;
read(10,*) a,b,c,d
print *, a,b,c,d
! This fails as reported.
rewind(10)
write(10,*) '1 2 3'
write(10,*) '/'
rewind(10)
a = -4; b = -4; c = -4; d = -4;
read(10,*) a,b,c,d
print *, a,b,c,d
close(unit=10, status='delete')
end program t
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30435