[Bug fortran/34599] New: Order: IOSTAT is wrongly set before data is transferred
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Dec 27 15:24:00 GMT 2007
This program is based on a failing test of the Unicomp Fortran 95 test suite;
while not all tests are correct (I found one which is listed as invalid code in
the Fortran 2003 standard, which fails in gfortran), I think the following is
valid. The problem is that gfortran sets the variable "is" to zero before it
transfers the data.
In "9.5.3 Execution of a data transfer input/output statement" one finds:
"[...]
(6) Transfer data between the file and the entities specified by the
input/output list (if any) or namelist.
(7) Determine whether an error, end-of-file, or end-of-record condition has
occurred."
The following program works with f95, ifort, sunf95 and openf95; it fails with
gfortran and g95.
program io_test
implicit none
integer :: is
character(len=20) :: str
is = 99
write (str, fmt=*, iostat=is) is
print *, is
print *, str
if (is /= 0) stop 'FAIL 1'
if (adjustl(str) /= '99') stop 'FAIL 2'
end program io_test
--
Summary: Order: IOSTAT is wrongly set before data is transferred
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34599
More information about the Gcc-bugs
mailing list