dear people, the following test code gives some unexpected results:
program dummy character(len=100) :: a integer :: i,ios i=777 a(:) = ' ' read(a,*,err=999) i print *,"i=",i i=666 read(a,*,iostat=ios) i print *,"i=",i IF (ios .ne. 0) print *,"read error: ios=",ios stop 999 print *,"read error occurred" end program dummy The test program should jump to label 999 as soon as the first read statement fails. (or is this not part of the standard? seems unlikely, but I am no expert on that). However, the program stops with a runtime error. The iostat error handler in the next read statement by the way does work correct. My screen output is: >gfortran -o dummy dummy.F90 >dummy At line 7 of file dummy.F90 Fortran runtime error: End of file > The gfortran version used for testing was: >gfortran -v Using built-in specs. Target: i386-linux Configured with: ../gcc/configure --prefix=/cosmic/coudert/tmp/gfortran-20060301/irun --enable-languages=c,fortran --host=i386-linux --with-gmp=/cosmic/coudert/tmp/gfortran-20060301/gfortran_libs Thread model: posix gcc version 4.2.0 20060228 (experimental) > best regards, Jos de Kloe -- Summary: incorrect behaviour of error-handler for internal read Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kloedej at knmi dot nl http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26509