------- Comment #4 from jvdelisle at gcc dot gnu dot org 2009-06-06 16:08 ------- In the test case, the the first EOF is generated in transfer.c (hit_eof) which sets the end file conditions. The second EOF is generated in list_read.c:1689. When returning from he error condition, the end file conditions are not set.
I have regtested this rough patch. Index: list_read.c =================================================================== --- list_read.c (revision 147996) +++ list_read.c (working copy) @@ -1687,6 +1687,11 @@ list_formatted_read_scalar (st_parameter if (setjmp (eof_jump)) { generate_error (&dtp->common, LIBERROR_END, NULL); + if (!is_internal_unit (dtp)) + { + dtp->u.p.current_unit->endfile = AFTER_ENDFILE; + dtp->u.p.current_unit->current_record = 0; + } goto cleanup; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40334