------- Comment #13 from jvdelisle at gcc dot gnu dot org 2007-03-07 06:40 ------- AFAICT A backspace is not allowed for namelist files according to 9.7.1
I interpret this to mean this is invalid code. Further, Note 9.54 states that if the preceding record read is the EOF record, the BACKSPACE would position the file to "before" the EOF. You can think of this as in between the last record and the EOF record. So subsequent reads will again read the EOF record. From the demo program, you can see the repeated values of ios=-1, or the EOF condition returned by gfortran. So I believe the gfortran behavior is correct. Regardless, I do think REWIND should clear the EOF condition for namelist and I don't think it is. I confirm this as a bug. I am working on it. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31052