Hi,
the following program shows a runtime bug with gfortran 4.3.x:
% cat gfcbug79.f90
program gfcbug79
implicit none
integer, parameter :: nnml = 10
character(len=8) :: model = ""
namelist /NML/ model
open (nnml, file='gfcbug79.nml')
write(nnml,*) "&nml"
write(nnml,*) " model='foo'! This is a just comment"
write(nnml,*) "/"
rewind(nnml)
read (nnml, nml=NML)
close(nnml)
write (*,nml=NML)
end program gfcbug79
% gfc gfcbug79.f90 && ./a.out
At line 14 of file gfcbug79.f90 (unit = 10, file = 'gfcbug79.nml')
Fortran runtime error: Invalid string input in item 0
%
Inserting a blank before the comment character ("!")
is a workaround, but gfortran should nevertheless be fixed.
Cheers,
-ha
--
Summary: Namelist reading bug with string constant immediately
followed by comment
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anlauf at gmx dot de
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36657