This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/34599] New: Order: IOSTAT is wrongly set before data is transferred


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]