gfortran (snapshot as of 12/17/04) compiled code gives a runtime error when 
reading formatted complex*16 values using the following program:

      program testIO
      implicit none
      integer i
      complex*16 values(5)
     
      open(7,file='test1.dat',status='old')
      read ( 7, '(5E15.8)' ) ( values (i), i = 1, 5 )
      print *, ( values (i), i = 1, 5 )      
      end

The text file "test1.dat" contains:

 2.00000000E+00 0.00000000E+00 2.52505826E-01 0.00000000E+00 1.44380768E-04
-1.11464849E-18 1.01002561E-01 0.00000000E+00-2.52507036E-02 0.00000000E+00

The code was compiled and executed with "gfortran bug.f; a.out", and produced
the following error message:

At line 8 of file bug2.f
Fortran runtime error: End of file

The code works correctly when compiled with g77 and ifort (Intel Fortran),
and produces the output (g77):

 (2.,0.) (0.252505826,0.) (0.000144380768,-1.11464849E-18) (0.101002561,0.)
 (-0.0252507036,0.)


The code and data was extracted from the Harwell-Boeing collection of sparse
matrices, which is a commonly used format for sparse matrix computations.
See http://math.nist.gov/MatrixMarket/collections/hb.html.

Additional information:

"gfortran -v" gives:

Reading specs from
/auto/home0/rmunk/temp_gfortran/irun/bin/../lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --enable-languages=c,f95
--prefix=/usr/work/2004352/irun
Thread model: posix
gcc version 4.0.0 20041217 (experimental)


Best regards,
  Rasmus Munk Larsen, Stanford University

-- 
           Summary: runtime error when reading complex*16 using formatted
                    I/O
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rmunk at quake dot stanford dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to