[Bug fortran/20131] New: gfortan - incorrectly reads beyond the end of line.

dir at lanl dot gov gcc-bugzilla@gcc.gnu.org
Tue Feb 22 07:17:00 GMT 2005


I finally realized that this is actually the source of most of the data reading
problems that I have had. If you look at the hex dump of the file, the first
line has extra padding blanks and reads correctly. The second line has no
padding and gfortran reads past the end of line and takes data from the third
line and prints it.


[dir:~/tests/gfortran] dir% gfortran -o fread03 fread03.f
[dir:~/tests/gfortran] dir% fread03 < fread03.dat
    1    0
    1    2
STOP 0
[dir:~/tests/gfortran] dir% cat fread03.f
      program main
      do 10 j=1,2 
      read(5,1010)  nload,npr2
      write(6,1010) nload,npr2
   10 continue
 1010 format (16i5)
      stop
      end

[dir:~/tests/gfortran] dir% cat fread03.dat
    1          
    1
    2
[dir:~/tests/gfortran] dir% dump -i fread03.dat

   File name: fread03.dat   Block number: 0   Byte number: 0

0000  20 20 20 20 31 20 20 20  20 20 20 20 20 20 20 0a      1           .
0010  20 20 20 20 31 0a 20 20  20 20 32 0a 00 00 00 00      1.     2.
EOF encountered. Do you want to continue ? n

-- 
           Summary: gfortan - incorrectly reads beyond the end of line.
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dir at lanl dot gov
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: powerpc-apple-darwin7.8.0


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



More information about the Gcc-bugs mailing list