Consider the following example:

$cat myread.f
      integer n, i idmy
      character*2 typ(10)
      character*10 lab(10)
      character*40 wav(10)
      integer pos(10), neg(10), iat(10), ieq(10)
      complex val(10)

      open(10,file='XX',status='old')
      read(10,*,err=950,end=990) n
      do idmy=1,n
        read(10,*,err=950,end=990) i,typ(i),lab(i),
     $       pos(i),neg(i),
     $       ieq(i),wav(i),iat(i),val(i)

        write(*,*)i,typ(i),lab(i),
     $       pos(i),neg(i),
     $       ieq(i),wav(i),iat(i),val(i)

      enddo

      stop
 950  write(*,*)'error reading file'
      stop
 990  write(*,*)'unexpected end of file'
      end


and the file:
$cat XX
     2
      3 'R '  'R1        ' 
      3     48      0
'                                        '      0
(  0.4000000E-05,   0.000000    )
      4 'R '  'RR        ' 
     16     14      0
'                                        '      0
(  0.7830000    ,   0.000000    )


When compiled using GNU Fortran (GCC) 4.3.0 20071209 (experimental)
$ /usr/local/gcc-svn/bin/gfortran myread.f 
$ ./a.out
 error reading file

yet when using the system gfortran (GNU Fortran 95 (GCC) 4.1.2 (Gentoo 4.1.2)
)
I get:
$ gfortran myread.f 
$ ./a.out
           3 R R1                   3          48           0                  
                                 0 ( 4.0000000E-06,  0.000000    )
           4 R RR                  16          14           0                  
                                 0 ( 0.7830000    ,  0.000000    )

which is as expected.

This error has crept in sometime since 01 December, and appears to be in
libgfortran, as programs compiled before 01 December also exhibit this error
when run now, yet did not do so before I did my weekly build of gcc-4.3.0 on 09
December 2007.


-- 
           Summary: List directed reads from file fails
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eesrjhc at bath dot ac dot uk
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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

Reply via email to