Fix FLUSH IOSTAT value
PR libfortran/101255 libgfortran/ChangeLog: * io/file_pos.c: Fix error code. gcc/testsuite/ChangeLog: * gfortran.dg/iostat_5.f90: New file.
This commit is contained in:
parent
3f624a624a
commit
c14f38d429
16
gcc/testsuite/gfortran.dg/iostat_5.f90
Normal file
16
gcc/testsuite/gfortran.dg/iostat_5.f90
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
! PR libfortran/101255
|
||||||
|
! { dg-do run }
|
||||||
|
|
||||||
|
program test
|
||||||
|
use ISO_FORTRAN_ENV, only: IOSTAT_EOR, IOSTAT_END
|
||||||
|
implicit none
|
||||||
|
character(len=50) :: err
|
||||||
|
integer :: i
|
||||||
|
|
||||||
|
err = ""
|
||||||
|
flush(99, iostat=i, iomsg=err)
|
||||||
|
|
||||||
|
if (err == "") stop 1
|
||||||
|
if (i >= 0) stop 2
|
||||||
|
if (i == IOSTAT_EOR .or. i == IOSTAT_END) stop 3
|
||||||
|
end
|
@ -527,7 +527,7 @@ st_flush (st_parameter_filepos *fpp)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* FLUSH on unconnected unit is illegal: F95 std., 9.3.5. */
|
/* FLUSH on unconnected unit is illegal: F95 std., 9.3.5. */
|
||||||
generate_error (&fpp->common, LIBERROR_BAD_OPTION,
|
generate_error (&fpp->common, -LIBERROR_BAD_UNIT,
|
||||||
"Specified UNIT in FLUSH is not connected");
|
"Specified UNIT in FLUSH is not connected");
|
||||||
|
|
||||||
if (needs_unlock)
|
if (needs_unlock)
|
||||||
|
Loading…
Reference in New Issue
Block a user