[Bug libfortran/25139] "Invalid argument" error on I/O

fxcoudert at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Nov 29 12:29:00 GMT 2005



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2005-11-29 12:29 -------
The testcase can be reduced further:

      integer dat(5)
      dat = (/ 0, 0, 0, 0, 1 /)
      write(11) dat,dat,dat,dat
      rewind 11
      write(11) dat
      read(11,end=1008) dat
 1008 continue
      backspace 11
      write(11) dat
      read(11,end=1011) dat
 1011 continue
      backspace 11
      backspace 11
      end

At line 13 of file testio2.f
Fortran runtime error: Invalid argument


>From looking at the fort.11 file, I think the output is correct at every point
of the program. Also note that if we comment two lines of this testcase, like
that:

      integer dat(5)
      dat = (/ 0, 0, 0, 0, 1 /)
      write(11) dat,dat,dat,dat
      rewind 11
      write(11) dat
      read(11,end=1008) dat
 1008 continue
!      backspace 11
!      write(11) dat
      read(11,end=1011) dat
 1011 continue
      backspace 11
      backspace 11
      end

then we get another error message (which shouldn't happen):

At line 10 of file testio2.f
Fortran runtime error: Read past ENDFILE record

I don't know yet if these bugs have the same cause.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-11-29 12:12:42         |2005-11-29 12:29:53
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25139



More information about the Gcc-bugs mailing list