public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/19657] New: Namelist reading may be skipped if end with a logical variable
@ 2005-01-27 13:31 fuyuki at ccsr dot u-tokyo dot ac dot jp
  2005-04-18  7:59 ` [Bug libf2c/19657] " fxcoudert at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fuyuki at ccsr dot u-tokyo dot ac dot jp @ 2005-01-27 13:31 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-06-05 23:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-27 13:31 [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
2005-04-18  7:59 ` [Bug libf2c/19657] " fxcoudert at gcc dot gnu dot org
2005-04-18 21:44 ` cvs-commit at gcc dot gnu dot org
2005-04-23 16:20 ` pault at gcc dot gnu dot org
2005-06-05 23:35 ` cvs-commit at gcc dot gnu dot org
2005-06-05 23:36 ` tobi at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).