In fortran 90 namelists allocatable arrays are not permited (alas), but type-derived structures are.
Given a structured variable such as, for instance
example%index=1
example%name=“filename”
example%array=0., 0.
pgf90 can read the namelist correctly, but writes it out in an expected way:
&NAMELIST_INPUT
EXAMPLE = 1,
"filename ",
0.000000 ,
0.000000
/
The output of the namelist is no longer human-friendly, as the variable names are not fully spelled out.
Admitedly, the f90 standard specifies that the output should be
variable_name= values
without specifying that the variable name should include the component name when the variable has a structure.
Both Intel and gfortran deal with namelist output in the form fortran programmers would consider natural, and write the output namelist as
example%index=1
example%name=“filename”
example%array=0., 0.
Is there an option or switch in the pgf90 compilor that would produce the desired behaviour?
Or do we report this as a pgf90 bug?
Below is a simple test code displaying this behaviour.
program namelist_test
implicit none
type ExampleTyp
integer :: index
character(len=20) :: name
real, dimension(2) :: array
end type ExampleTyp
type (ExampleTyp) :: example
namelist/namelist_input/example
example%index=1
example%name="wrong"
example%array=1.
open(unit=22,status='new',file='fort.22')
write (22,namelist_input)
close(22)
open(unit=10,status='old',file='fort.10')
read (10,namelist_input)
close(10)
open(unit=21,status='new',file='fort.21',DELIM="quote")
write (21,namelist_input)
close(21)
end program namelist_test
The input file is fort.10:
&namelist_input
example%index=1,
example%name="filename"
example%array=2*0.0
/ !end namelist_input