https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61632
--- Comment #15 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Its sort of like Steve said earlier. The coder is choosing to ignore an
> error condition so anything gfortran does is valid. In this case the
> output got writen to buffer before the error occurred. You are bypassing
> all of the normal error handling when you do this. The buffer got flushed.
>
> Its not worth the time to change any of it really.
>
> The program should exit, its invalid.
Well, I disagree with this interpretation: I did not find anywhere in the
standard that the variable set by iostat has to be used. In addition, the
following code should be valid upon Steve's rules and still prints 'YYY' (g95
does not).
[Book15] f90/bug% cat pr61632_1_red.f90
program p
call ss0()
end program p
subroutine ss0
CHARACTER(3), save :: ZTYP(3)
DATA ZTYP /'XXX','YYY','ZZZ'/
write(*,600,ERR=10,IOSTAT=iosa) 'AAA',0.0,ZTYP
600 FORMAT(A3,1PE13.5,A3)
print *, 'success'
return
10 print *,
print *, 'iostat =', iosa
end subroutine ss0
[Book15] f90/bug% a.out
AAA 0.00000E+00XXX
YYY
iostat = 5006
IMO this PR boils down to the fact that the I/O processing is not reset to a
clean state after an error is handled with ERR, IOSTAT, ... , as it should.
Along this line, I have found that 'parse_format' is called only once even if
'ss' is called twice.