http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52606

--- Comment #5 from Janne Blomqvist <jb at gcc dot gnu.org> 2012-03-20 10:27:33 
UTC ---
(In reply to comment #4)
> Indeed, one can construct examples which exceed the length: Namely module
> procedures or module variables. The problem is that GFC_MAX_MANGLED_SYMBOL_LEN
> allows for GFC_MAX_SYMBOL_LEN*2+4 = 130 characters but one has the prefix "__"
> plus "_MOD_" which is not 4 but 7 characters long. Thus, if one goes to the
> limit, one can create symbols which have the same mangled name. 

Yes. I suspect this bug dates back to the patch that introduced the _MOD_
scheme. Previously gfortran just used "_" to separate the module and procedure
name, allowing a cleverly named external procedure to clash with a module
procedure. 

>Though, using
> both the maximal length for the module name and for the symbol name is a very
> constructed example.

Indeed. If my suspicion above is correct, the bug has been present for ages,
and no PR has been filed.

> On the other hand, PR 51802 does not inspire at all: That PR is about
> polymorphism-related names. And those are hashed if they don't fit.

Ah, I forgot about the hashing scheme, and assumed that as per the PR
identifiers appears up to three times in the mangled name, the factor "*2" in
the calculation of GFC_MAX_MANGLED_SYMBOL_LEN would be incorrect (in addition
to the additive factor being incorrect).

What was the motivation for this hashing scheme, BTW? Linkers already support
1) long symbol names (I read somewhere that OpenOffice has symbols up to 4000
(!!!) characters long) 2) various symbol hashing schemes (see e.g.
DT_GNU_HASH).

Reply via email to