This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, gfortran] common blocks getting mangled in nested modules
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: Tobias dot Schlueter at Physik dot Uni-Muenchen dot DE
- Cc: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>,patch <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 19 Aug 2005 07:24:57 +0200
- Subject: Re: [Patch, gfortran] common blocks getting mangled in nested modules
- References: <1124396183.4304ec973d049@www.cip.physik.uni-muenchen.de>
Tobi,
What if one uses different modules which contain the same common block, will
they not interfere?
Yes, they are correctly determined to be ambiguous.
gfortran - Error: Name 'a' at (1) is an ambiguous reference to 'a' from
module 'm1'
ifc - Error 119 at (11:collision.f90) : More than one program entity
with this name is accessible
Standard - 11.3.2: ".... Except for these cases, the local name for any
entity given accessibility by a USE statement shall differ from the
local names of all other entities accessible to the scoping unit through
USE statements and otherwise."
However this:
module m1
common /x/ a
end module m1
module m2
common /x/ a
end module m2
program collision
use m1
use m2, only: b=>a
a = 1
print *, b
end program collision
is not being compiled correctly, since it produces a undefined reference
to `__m1__a'. It arrives at I believe this is symptomatic of the same
malady that is exposed by use+host associated common variables that we
have discussed off-list and that, I hope, will be fixed by a later patch
in the series.
Cheers
Paul T