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/24719] New: Summary: [4.1 Regression] Nonadvancing read does not read more than 1 line


Revision 1.64 of libgfortran/io/transfer.c causes a regression for the
following testcase:

% cat <<EOF > regression.f90
program demonstration
    implicit none
    character(len=1) :: saux
    open(unit = 1, FILE = "foo.conf", STATUS = 'OLD', ACTION = 'READ')
    do
10    read(unit = 1, fmt = '(a)', advance = 'no', end = 99, eor = 11) saux
      print *, "'", saux, "'"
      cycle
11    print *, "Newline"
    end do
99  close(1)
end program
EOF

% cat <<EOF > foo.conf
foo1: bar
1.2
EOF


ifort and g95 compiled binaries give:
 'f'
 'o'
 'o'
 '1'
 ':'
 ' '
 'b'
 'a'
 'r'
 Newline
 '1'
 '.'
 '2'
 Newline

while gfortran 4.1.0 20051024 gives only the characters from the first line of
'foo.conf', all characters after the first 'end of record' are whitespace:
 'f'
 'o'
 'o'
 '1'
 ':'
 ' '
 'b'
 'a'
 'r'
 Newline
 ' '
 ' '
 ' '
 Newline


For sake of compliance with the bug report policy:
* gfortran from cvs via 
    TZ=GMT cvs -q update -D'2005.10.24.03.00.00'
  works,
* gfortran from cvs via 
    TZ=GMT cvs -q update -D'2005.10.24.04.00.00'
  does not.

--------

By the way, there is another small issue with the above testcase. I'm not sure
if I should file a separate bug report for it:
Changing line 6 of regression.f90 to 

10    read(unit = 1, fmt = '(a)', advance = 'no', end = 99, eor = 10) saux

gives the incorrect warning:

 In file regression.f90:6

10    read(unit = 1, fmt = '(a)', advance = 'no', end = 99, eor = 10) saux
                                                                         1
Warning: Branch at (1) causes an infinite loop

while ifort and g95 do not complain.


-- 
           Summary: Summary: [4.1 Regression] Nonadvancing read does not
                    read more than 1 line
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sven dot buijssen at math dot uni-dortmund dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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