Use and rename bug: rings a bell?

FX fxcoudert@gmail.com
Fri Jan 18 18:13:00 GMT 2008


Hi all,

A colleague of mine is bitten by the following bug. I thought I'd post
it here before I open a PR, because I think there has been activity
recently on this USE statement with rename lists, so maybe someone's
dealing with it or is aware of an open PR:

I think both testcases below are valid, but gfortran rejects the
second one. They only differ in the order of USE statements.

$ cat test.f90
module common_init_conf
  integer, allocatable, dimension(:,:) :: Nmoltype_phase
end module common_init_conf

subroutine read_initial_config_nml()
  use common_init_conf, nmoltype_phase_com => nmoltype_phase
  use common_init_conf
  implicit none
  integer :: nmoltype_phase
  namelist /confNmoltypePhase/ nmoltype_phase
end subroutine read_initial_config_nml

$ gfortran -c test.f90 && echo OK
OK

$ cat test2.f90
module common_init_conf
  integer, allocatable, dimension(:,:) :: Nmoltype_phase
end module common_init_conf

subroutine read_initial_config_nml()
  use common_init_conf
  use common_init_conf, nmoltype_phase_com => nmoltype_phase
  implicit none
  integer :: nmoltype_phase
  namelist /confNmoltypePhase/ nmoltype_phase
end subroutine read_initial_config_nml

$ gfortran -c test2.f90
test2.f90:9.27:

  integer :: nmoltype_phase
                          1
Error: Symbol 'nmoltype_phase' at (1) already has basic type of INTEGER
test2.f90:10.45:

  namelist /confNmoltypePhase/ nmoltype_phase
                                            1
Error: NAMELIST attribute conflicts with ALLOCATABLE attribute in
'nmoltype_phase' at (1)





-- 
FX Coudert
http://www.homepages.ucl.ac.uk/~uccafco/



More information about the Fortran mailing list