Consider the following example: $cat myread.f integer n, i idmy character*2 typ(10) character*10 lab(10) character*40 wav(10) integer pos(10), neg(10), iat(10), ieq(10) complex val(10) open(10,file='XX',status='old') read(10,*,err=950,end=990) n do idmy=1,n read(10,*,err=950,end=990) i,typ(i),lab(i), $ pos(i),neg(i), $ ieq(i),wav(i),iat(i),val(i) write(*,*)i,typ(i),lab(i), $ pos(i),neg(i), $ ieq(i),wav(i),iat(i),val(i) enddo stop 950 write(*,*)'error reading file' stop 990 write(*,*)'unexpected end of file' end and the file: $cat XX 2 3 'R ' 'R1 ' 3 48 0 ' ' 0 ( 0.4000000E-05, 0.000000 ) 4 'R ' 'RR ' 16 14 0 ' ' 0 ( 0.7830000 , 0.000000 ) When compiled using GNU Fortran (GCC) 4.3.0 20071209 (experimental) $ /usr/local/gcc-svn/bin/gfortran myread.f $ ./a.out error reading file yet when using the system gfortran (GNU Fortran 95 (GCC) 4.1.2 (Gentoo 4.1.2) ) I get: $ gfortran myread.f $ ./a.out 3 R R1 3 48 0 0 ( 4.0000000E-06, 0.000000 ) 4 R RR 16 14 0 0 ( 0.7830000 , 0.000000 ) which is as expected. This error has crept in sometime since 01 December, and appears to be in libgfortran, as programs compiled before 01 December also exhibit this error when run now, yet did not do so before I did my weekly build of gcc-4.3.0 on 09 December 2007.
I believe it is a duplicate of PR 34404 and was fixed yesterday. Please update libgfortran (or the whole GCC) and try again. Thanks for the report.
Thanks everyone, revision 130775 fixes the problem.