[Bug fortran/19657] New: Namelist reading may be skipped if end with a logical variable
fuyuki at ccsr dot u-tokyo dot ac dot jp
gcc-bugzilla@gcc.gnu.org
Thu Jan 27 13:31:00 GMT 2005
If a namelist which contains a logical variable followed by the same one in a input file,
sometimes the second namelist is skipped to read. Maybe the example following shows you
clearer.
implicit none
logical l
integer i
namelist /nm/ i, l
100 continue
read(*,nm,end=190)
write (*,nm)
goto 100
190 continue
stop
end
This is an input file example.
&nm i=1,l=t &end
&nm i=2 &end
&nm i=3 &end
Ant the output is like this:
% ./a.out < inputfile
&NM
I = 1,
L = T/
&NM
I = 3,
L = T/
#
The second one is skipped.
I found two method to avoid this feature.
One way is that put the logical variable at the position except for the very end:
&nm l=t,i=1 &end
or
&nm i=1,l=t,&end
The comma after `t' helps to avoid skipping the next one.
The other way is that use `/' instead of &end (maybe this is standard way).
I think there is something wrong with syntax analysis for the logical constant.
My environment is like this.
% g77 -v
Reading specs from /usr/lib/gcc/i486-linux/3.4.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.4 20041218 (prerelease) (Debian 3.4.3-6)
I have tried this program with other versions. g77 3.3 has the same problem.
g77 2.95 does not.
--
Summary: Namelist reading may be skipped if end with a logical
variable
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fuyuki at ccsr dot u-tokyo dot ac dot jp
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19657
More information about the Gcc-bugs
mailing list