This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/52606] Confusing diagnostics for long identifiers


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-20 09:10:13 UTC ---
(In reply to comment #3)
> Finally, before attacking static GFC_MAX_SYMBOL_LEN buffers, I suggest getting
> rid of static buffers of GFC_MAX_MANGLED_SYMBOL_LEN size. We should get rid of
> that macro altogether. Also, FWIW, the value for that macro is too small at
> the moment, as it's easy to construct examples were the mangled name exceeds
> that value. See e.g. PR 51802 for inspiration. ;-)

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. Though, using
both the maximal length for the module name and for the symbol name is a very
constructed example.

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.


Example

module Very_long_module_name_having_a_length_of_63_characters_really_x
contains
subroutine an_extremely_long_subroutine_name_which_looks_rather_ugly123456
contains
subroutine an_extremely_long_internal_subroutine_name_which_looks_ugly
  type plus_a_very_very_very_long_type_name_of_almost_the_same_length
  end type
class(plus_a_very_very_very_long_type_name_of_almost_the_same_length), &
  allocatable :: t
end subroutine
end subroutine
end module


According to "nm", one then gets the following symbols - the last one should
end in "123456" but only ends in "123".

__very_long_module_name_having_a_length_of_63_characters_really_x_MOD___copy_1169DDF
__very_long_module_name_having_a_length_of_63_characters_really_x_MOD___def_init_1169DDF
__very_long_module_name_having_a_length_of_63_characters_really_x_MOD___vtab_1169DDF
__very_long_module_name_having_a_length_of_63_characters_really_x_MOD_an_extremely_long_subroutine_name_which_looks_rather_ugly123


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