This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, gfortran] common blocks getting mangled in nested modules


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





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]