Namespace question

Brooks Moses bmoses@stanford.edu
Mon Oct 9 19:17:00 GMT 2006


Tobias Burnus wrote:
> but gfortran complains:
>     namelist /ops/ my
>                 1
> Error: PROCEDURE attribute conflicts with NAMELIST attribute in 'my' at (1)
> 
> Who is right? I'm inclined to claim that gfortran is wrong. Especially
> since the error only occures when "namespace" is present.
> 
> ---------------
> program main
>   implicit none
> contains
>   subroutine my
>   end subroutine my
>   subroutine bar
>     integer :: my
>     namelist /ops/ my
>   end subroutine bar
> end program main
> ---------------

Gfortran is wrong.  The INTEGER declaration in BAR declares MY as a 
local variable, thus overriding the host association of MY as the 
subroutine from the main program.  Thus, as far as NAMELIST is 
concerned, this is an ordinary integer variable.

I seem to recall that there have been weird glitches with host 
association before; this is presumably just more of the same.

- Brooks



More information about the Fortran mailing list