A colleague has discovered a problem in a library that I wrote. Being
a good `debugger', he has already distilled a minimal skeleton from my
code:
module foo1
type, public :: xx
integer :: i
end type xx
end module foo1
module foo2
use foo1, only: xx0=>xx
private
public :: xx0
end module foo2
module foo3
use foo2, only: xx0
private
type, public :: xx
type(xx0) :: g
end type xx
end module foo3
module foo
use foo3, only: xx
contains
subroutine foobar(x)
type(xx), intent(in) :: x
end subroutine foobar
end module foo
DIGITAL Fortran complaines:
ohl@nhc:~ohl$ f90 -version foo.f90
DIGITAL Fortran 90 V5.1-594
f90: Error: foo.f90, line 25: The same named entity from different
modules and/or program units cannot be referenced. [XX]
type(xx), intent(in) :: x
---------^
while NAG f95 accepts the source and produces correct code. We both
think that DIGITAL Fortran is incorrect and that my code is correct.
What's the opinion of the board's combined expertise?
Cheers,
-Thorsten
PS: In case anybody wonders what the real world code is about: the
construction is used to switch from serial to parallel (MPI) code
by changing only one line from
use vamp
to
use vampi
in application programs, when the MPI version requires additional
bookkeeping.
(see ftp://heplix.ikp.physik.tu-darmstadt.de/pub/ohl/vamp/)
--
Thorsten Ohl, Physics Department, TU Darmstadt -- [log in to unmask]
http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|