User account creation filtered due to spam.

Bug 39528 - [4.3 Regression] repeated entries are not read when using list-directed input
Summary: [4.3 Regression] repeated entries are not read when using list-directed input
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.2
: P4 normal
Target Milestone: 4.3.4
Assignee: Jerry DeLisle
URL:
Keywords: wrong-code
Depends on:
Blocks: 32834
  Show dependency treegraph
 
Reported: 2009-03-23 14:56 UTC by Aron BROLLY
Modified: 2009-04-04 19:10 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.4.5
Known to fail: 4.3.3 4.2.3
Last reconfirmed: 2009-03-24 01:15:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aron BROLLY 2009-03-23 14:56:51 UTC
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
Comment 1 Dominique d'Humieres 2009-03-23 15:10:51 UTC
Confirmed on powerpc-apple-darwin9 for trunk, 4.3.3, and 4.2.3.

Comment 2 Dominique d'Humieres 2009-03-23 17:39:59 UTC
It is a regression with respect to g77.

Comment 3 Joost VandeVondele 2009-03-23 19:26:59 UTC
good old Fortran.. (fine with NAG as well)
Comment 4 Dominique d'Humieres 2009-03-23 21:04:21 UTC
Jerry could you have a look at this one? TIA

Comment 5 Jerry DeLisle 2009-03-24 01:15:26 UTC
I will give this a shot.
Comment 6 Jerry DeLisle 2009-03-24 12:24:42 UTC
Subject: Bug 39528

Author: jvdelisle
Date: Tue Mar 24 12:24:29 2009
New Revision: 145030

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145030
Log:
2009-03-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/39528
	* io/list_read.c (list_formatted_read_scalar): Move check for read
	completion to just after the check for a repeated value.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/list_read.c

Comment 7 Jerry DeLisle 2009-03-24 12:30:33 UTC
Subject: Bug 39528

Author: jvdelisle
Date: Tue Mar 24 12:30:17 2009
New Revision: 145031

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145031
Log:
2009-03-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/39528
	* gfortran.dg/read_repeat.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/read_repeat.f90
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 8 Jerry DeLisle 2009-03-24 12:33:13 UTC
Fixed on 4.4.
Comment 9 Jerry DeLisle 2009-03-29 00:30:40 UTC
Subject: Bug 39528

Author: jvdelisle
Date: Sun Mar 29 00:30:17 2009
New Revision: 145221

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145221
Log:
2009-03-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/39528
	* io/list_read.c (list_formatted_read_scalar): Move check for read
	completion to just after the check for a repeated value.

Modified:
    branches/fortran-dev/libgfortran/ChangeLog.dev
    branches/fortran-dev/libgfortran/io/list_read.c

Comment 10 Joseph S. Myers 2009-03-31 21:12:19 UTC
Closing 4.2 branch.
Comment 11 Dominique d'Humieres 2009-04-04 09:10:19 UTC
Could the patch be back-ported to 4.3? TIA.
Comment 12 Jerry DeLisle 2009-04-04 15:32:15 UTC
Yes, I will port to 4.3
Comment 13 Jerry DeLisle 2009-04-04 19:05:08 UTC
Subject: Bug 39528

Author: jvdelisle
Date: Sat Apr  4 19:04:53 2009
New Revision: 145548

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145548
Log:
2009-04-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/39528
	* gfortran.dg/read_repeat.f90: New test.

2009-04-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/39528
	Backport from trunk.
	* io/list_read.c (list_formatted_read_scalar): Move check for read
	completion to just after the check for a repeated value.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/read_repeat.f90
Modified:
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_3-branch/libgfortran/ChangeLog
    branches/gcc-4_3-branch/libgfortran/io/list_read.c

Comment 14 Jerry DeLisle 2009-04-04 19:10:11 UTC
Fixed on 4.3, closing.