This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46010] I/O: Namelist-reading bug
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 14 Oct 2010 08:09:25 +0000
- Subject: [Bug fortran/46010] I/O: Namelist-reading bug
- Auto-submitted: auto-generated
- References: <bug-46010-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46010
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-14 08:09:04 UTC ---
Reduced test case:
----------nml.dat-----------------------
&namtoptrc
tracer(1) = 'Aa', .true.
tracer(2) = 'Bb', .true.
tracer(3) = 'Cc', .true.
/
----------------------------------------
----------test.f90----------------------
TYPE PTRACER
CHARACTER(len = 2) :: sname
LOGICAL :: lini
END TYPE PTRACER
TYPE(PTRACER) , DIMENSION(3) :: tracer
NAMELIST/namtoptrc/ tracer
open (99, file='nml.dat')
read (99, nml=namtoptrc)
write (*, nml=namtoptrc)
end
----------------------------------------
Works with -std=f90/f2003/f2008 but fails with without -std=f* (i.e. with
-std=gnu) as follows:
At line 10 of file test.f90 (unit = 99, file = 'nml.dat')
Fortran runtime error: Cannot match namelist object name 'bb'
The issue is really the ".true." ("T","true", ".false.", "F", "false"). If the
last item (in the namelist and in the derived type) is an integer or a string
it works.