This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46313] [OOP] class container naming collisions
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 9 Nov 2010 18:16:09 +0000
- Subject: [Bug fortran/46313] [OOP] class container naming collisions
- Auto-submitted: auto-generated
- References: <bug-46313-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46313
--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-09 18:16:06 UTC ---
I think one needs to add all names to the namespace:
<module>_<subroutine>_<internal-sub>_<type>
<module>_<submodule-1>_<submodule-2>_<type>
etc. (Note: This can give extremely long variable names; I am not sure how
assemblers handle those.)
Note: I see an additional issue with the current scheme.
module one
type two_three
end type two_three
end module one
module one_two
type three
end type three
end module one_two
use one_two
class(two_three), allocatable :: a1
class(three), allocatable :: a2
end
produce the same __vtable entry. Names not possible in Fortran are "."
(period), capital letters (A-Z) and $ (which is allowed as common vendor
extension). The underscore (_) is not allowed as first character, but later in
the name it is allowed.
I wonder whether the following is valid or not - I think it is not. The
question is whether one can find it in real-world code, where "m" and "m" are
in different translation units (= files).
module m
type t
end type t
end module m
subroutine m()
type t
end type t
end subroutine m
In principle, I am inclined to close this PR as WONTFIX - and wait for
real-world bug reports. I think the case of comment 0 of having the same-named
polymorphic types in different modules *can* happen in large real-world
programs. But all other examples are a bit artificial. I wonder whether one
should fix the first testcase in this file - as changing the main pattern will
break the ABI. Things like adding further strings could be done later without
breaking the main ABI. (Except the strings get too long for the assemblers.)