This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/24416] New: Wrong reading following namelist reading
- From: "jg69 at le dot ac dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Oct 2005 21:40:04 -0000
- Subject: [Bug libfortran/24416] New: Wrong reading following namelist reading
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
$ cat foo.f90
PROGRAM foo
IMPLICIT NONE
CHARACTER(len=10) name,var
NAMELIST /input/ var
OPEN(unit=1,file="input.tmp",delim='apostrophe',status='unknown')
READ(1,NML=input)
CLOSE(1)
OPEN(unit=1,file="toto.tmp",status='old')
READ(1,*) name
CLOSE(1)
WRITE(*,*) name
END PROGRAM foo
$ gfortran-4.0 foo.f90
$ cat input.tmp
&INPUT
var='not '
/
$ cat toto.tmp
good
$ a.out
not good
Well, if it's written...
So, for some reason the value of 'var' is concatenated to that of name.
This is also the case when reading a number from 'toto.tmp' instead of a
string.
In that case the correct read number appears concatenated to some other number
(corresponding to 'var' presumably).
The problem does not occur when the last variable of the namelist is not a
character type.
$ gfortran-4.0 -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.0/configure
--prefix=/usr/local/stow/gcc-4.0-1
--enable-languages=c,f95
--with-gmp=/usr/local/stow/gmp-4.1.4
--with-mpfr=/usr/local/stow/mpfr-2.1.1
--program-suffix=-4.0
Thread model: posix
gcc version 4.0.0
--
Summary: Wrong reading following namelist reading
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jg69 at le dot ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24416