https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101255
Bug ID: 101255
Summary: FLUSH statement - error should be negative
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
F2018 states:
"Fortran 2008 specifies that the IOSTAT= variable shall be set to a
processor-dependent negative value if the flush operation is not supported for
the unit specified. This document specifies that the processor-dependent
negative27integer value shall be different from the named constants IOSTAT_EOR
or IOSTAT_END from the intrinsic28module ISO_FORTRAN_ENV."
However, the following program prints:
5002 Specified UNIT in FLUSH is not connected
-2 -1
shouldn't the 5002 be a negative number (such as -5002)?
use iso_fortran_env
implicit none
character(len=50) :: err
integer :: i
!open(99)
!close(99)
flush(99,iostat=i,iomsg=err)
print *, i, err
print *, IOSTAT_EOR , IOSTAT_END
end