CR-LF (the DOS convenction for text files) as record separators don't work well for formatted input, either: $ cat dosfile-2.f program main write (12,'(2A)') ' 1',achar(13) write (12,'(2A)') ' 2',achar(13) rewind(12) read(12,'(I4)') n1 print *,n1 read(12,'(I5)') n2 print *,n2 end $ gfortran dosfile-2.f $ ./a.out 1 At line 7 of file dosfile-2.f Fortran runtime error: Bad value during integer read $ gfortran -v ; gfortran -dumpmachine Using built-in specs. Configured with: ../gcc/configure --prefix=/home/ig25 --enable-languages=c,f95 Thread model: posix gcc version 4.0.0 20050127 (experimental) i686-pc-linux-gnu $ od -c fort.12 0000000 1 \r \n 2 \r \n 0000014
Patch proposed: http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01510.html
Subject: Bug 19679 CVSROOT: /cvs/gcc Module name: gcc Changes by: fxcoudert@gcc.gnu.org 2005-03-25 13:35:29 Modified files: gcc/testsuite : ChangeLog libgfortran : ChangeLog libgfortran/io : list_read.c transfer.c Added files: gcc/testsuite/gfortran.dg: dos_eol.f Log message: PR libfortran/19678 PR libfortran/19679 * gfortran.dg/dos_eol.f: New test. PR libfortran/19678 * list_read.c (next_char, eat_separator, finish_separator, read_real) (namelist_read): Add support for '\r' as well as '\n' as EOL character. PR libfortran/19679 * list_read.c (read_sf): Add a '\r' in a test to support DOS line-endings when line length is exceeded. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5216&r2=1.5217 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/dos_eol.f.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.177&r2=1.178 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/list_read.c.diff?cvsroot=gcc&r1=1.14&r2=1.15 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/transfer.c.diff?cvsroot=gcc&r1=1.32&r2=1.33
Fixed.
Subject: Bug 19679 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: fxcoudert@gcc.gnu.org 2005-03-25 13:40:20 Modified files: gcc/testsuite : ChangeLog libgfortran : ChangeLog libgfortran/io : list_read.c transfer.c Added files: gcc/testsuite/gfortran.dg: dos_eol.f Log message: PR libfortran/19678 * list_read.c (next_char, eat_separator, finish_separator, read_real) (namelist_read): Add support for '\r' as well as '\n' as EOL character. PR libfortran/19679 * list_read.c (read_sf): Add a '\r' in a test to support DOS line-endings when line length is exceeded. PR libfortran/19678 PR libfortran/19679 * gfortran.dg/dos_eol.f: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.68&r2=1.5084.2.69 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/dos_eol.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.163.2.10&r2=1.163.2.11 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/list_read.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.14&r2=1.14.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/transfer.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.32&r2=1.32.2.1