The test program is:

program test

implicit none

type line_struct
  integer :: width = 10
end type

type symbol_struct
  integer :: typee = 10
end type

type curve_struct
  type (line_struct) line
  type (symbol_struct) symbol
end type

type (curve_struct) curve(10)

namelist / params / curve

!

open (1, file = 'test.nml')
read (1, nml = params)
print *, curve(1)%symbol%typee

end program

The test.nml file is:

&params
        curve(1)%symbol%typee = 1
/



Compiling with "gfortran test.f90" and running gives:

lnx4103:~/bmad/bmad_dist/test> gfortran test.f90;./a.out
At line 25 of file test.f90 (unit = 1, file = 'test.nml')
Fortran runtime error: End of file


Now if you reverse the line and symbol components of the curve_struct:

type curve_struct
  type (symbol_struct) symbol
  type (line_struct) line
end type

Now the program runs fine:

lnx4103:~/bmad/bmad_dist/test> gfortran test.f90;./a.out
           1

I am running on Linux:

lnx4103:~/bmad/bmad_dist/test> uname -a
Linux lnx4103.lns.cornell.edu 2.6.18-194.11.1.el5 #1 SMP Tue Aug 10 16:39:28
EDT  2010 x86_64 x86_64 x86_64 GNU/Linux


-- David


-- 
           Summary: gfortran namelist read error
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: david dot sagan at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45532

Reply via email to