This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libf2c/6367: multiple repeat counts confuse namelist read into array
- From: mcdonald at mmace dot nrl dot navy dot mil
- To: gcc-gnats at gcc dot gnu dot org
- Date: 18 Apr 2002 20:22:18 -0000
- Subject: libf2c/6367: multiple repeat counts confuse namelist read into array
- Reply-to: mcdonald at mmace dot nrl dot navy dot mil
>Number: 6367
>Category: libf2c
>Synopsis: multiple repeat counts confuse namelist read into array
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 18 13:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Jim McDonald
>Release: gcc 2.96
>Organization:
>Environment:
RedHat Linux 7.2
>Description:
A one-dimensional array assigned values by a namelist read
statement receives those values in the wrong array elements
when the namelist input contains an array assignment with
(1) an array subscript and
(2) more than one repeat count specifier with dissimilar
counts.
I have produced the same incorrect result using g77 3.1,
f2c, and g77 under cygwin/Win2000. Other Fortran
compilers not using f2c's library (such as Lahey Fortran
95 ver.6.1 under RH Linux 7.2) yield the correct result.
Note - this bug is similar to but not the same as the
namelist repeat count bug fixed 1999-jun-27; from
www.netlib.org f2c "changes" list:
Sun Jun 27 22:05:47 EDT 1999
libf2c.zip, libi77: rsne.c: fix bug in namelist input:
a misplaced increment could cause wrong array elements
to be assigned; e.g.,
"&input k(5)=10*1 &end" assigned k(5) and k(15 .. 23).
>How-To-Repeat:
Compile this 10-line Fortran77 program:
program testnl
c
dimension a(10)
namelist /nl/ a
data a / 10 * 0.0 /
c
read(5,nl)
write(6,*) a
c
end
Now run the program with this input data,
&nl a(2) = 3*1.0, 2*2.0, 3*3.0 /
and you will probably see this incorrect result:
0. 1. 1. 1. 2. 3. 3. 0. 0. 0.
The correct result should be
0. 1. 1. 1. 2. 2. 3. 3. 3. 0.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: