When I read repeated entries using list-directed input and 
I use a slash to terminate the read, the number of entries read
in the last series depends on the position of the closing slash.  
In addition, an additional entry at the end corrects the problem.

The test program:
program rread
  implicit none
  integer :: iarr(1:7), ia, ib, i

  do i=1,7
    iarr(i)= 0
  enddo

  read(*,*) (iarr(i), i=1,7)
  read(*,*) ia, ib

  write(*,*) (iarr(i), i=1,7)
  write(*,*) ia, ib
end program rread

Example input #1:
 2*1  3*2 /
12
13

gfortran gives:
  1           1           2           0           0           0           0
 12          13

Intel fortran gives:
  1           1           2           2           2           0           0
 12          13


Example input #2:
 2*1  3*2 
/
12
13

Both gfortran and Intel fortran give:
  1           1           2           2           2           0           0
 12          13


Example input #3:
 2*1  3*2 5 /
12
13

Both gfortran and Intel fortran give:
  1           1           2           2           2           5           0
 12          13


My system is the following:

CPU:  
AMD Athlon(tm) 64 X2 Dual Core Processor 4200+

version of the kernel:
Linux 2.6.18-6-amd64 #1 SMP Thu Dec 25 21:08:54 UTC 2008 x86_64 GNU/Linux

I use gfortran from a chrooted Debian 5.0.0 (codename: lenny) system.
(My outside system is a Debian 4.0 release7 (codename: etch) one.)

gfortran -v -save-temps -o rrGF-bug ./rread.f90
Driving: gfortran -v -save-temps -o rrGF-bug ./rread.f90 -lgfortranbegin
-lgfortran -lm -shared-libgcc
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1.1)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'rrGF-bug' '-shared-libgcc'
'-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.3.2/f951 ./rread.f90 -quiet -dumpbase
rread.f90 -mtune=generic -auxbase rread -version -fintrinsic-modules-path
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/finclude -o rread.s
GNU F95 (Debian 4.3.2-1.1) version 4.3.2 (x86_64-linux-gnu)
        compiled by GNU C version 4.3.2, GMP version 4.2.2, MPFR version 2.3.2.
warning: MPFR header version 2.3.2 differs from library version 2.3.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'rrGF-bug' '-shared-libgcc'
'-mtune=generic'
 as -V -Qy -o rread.o rread.s
GNU assembler version 2.18.0 (x86_64-linux-gnu) using BFD version (GNU Binutils
for Debian) 2.18.0.20080103
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.3.2/:/usr/lib/gcc/x86_64-linux-gnu/4.3.2/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.3.2/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.3.2/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.3.2/:/usr/lib/gcc/x86_64-linux-gnu/4.3.2/:/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'rrGF-bug' '-shared-libgcc'
'-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.3.2/collect2 --eh-frame-hdr -m elf_x86_64
--hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o rrGF-bug
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.3.2 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2
-L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../.. rread.o
-lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crtn.o


-- 
           Summary: gfortran: repeated entries are not read when using list-
                    directed input
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brolly at aeki dot kfki dot hu
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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

Reply via email to