This is the mail archive of the gcc@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]

C++ mangle bugs, anyone?


More than a week ago I posted an article about a bug in the (C++)
mangler, requesting a discussion.  Nobody reacted at all.

I'd think that errors in how functions are mangled are very
serious, because they cause the compiler to be incompatible with
the final release of 3.0 (after this got fixed).

Does the silence after my mail mean that the gurus think I am
wrong?  Or right?  When I knew you agreed with me, then perhaps
I could come up with a patch myself, because I need this to be
fixed asap.

-- 
Carlo Wood <carlo@alinoe.com>

PS 

At this moment "<return_type> (<scopetype>::*)(<p1>, <p2>, ..., <pN>) const" results in
a mangled name of "KM<scopetype>F<return_type><p1><p2>...<pN>E" (and visa versa) but
a 'const' behind the "(<scopetype>::* const)" disappears in a mangled name.

The summary of how to fix the reported problem was posted to gcc-bugs and is repeated
below.  Please see the original post for the reasoning that this is a correct solution.

Bug1:

  A 'K' in front of (member) function pointers (and references) need 
  to make the pointer (reference) const, not the function:

  KPF<return_type><p1><p2>...<pN>E               --> <return_type> (* const)(<p1>, <p2>, ..., <pN>)
  KRF<return_type><p1><p2>...<pN>E               --> <return_type> (& const)(<p1>, <p2>, ..., <pN>)
  KM<scopetype>F<return_type><p1><p2>...<pN>E    --> <return_type> (<scopetype>::* const)(<p1>, <p2>, ..., <pN>)

Bug2:

  A possibility needs to be added to the mangling sheme to mangle
  const functions, this should be done as was done in with the old
  ABI by putting the qualifier in front of the 'F':

  PKF<return_type><p1><p2>...<pN>E               --> <return_type> (*)(<p1>, <p2>, ..., <pN>) const
  RKF<return_type><p1><p2>...<pN>E               --> <return_type> (&)(<p1>, <p2>, ..., <pN>) const
  M<scopetype>KF<return_type><p1><p2>...<pN>E    --> <return_type> (<scopetype>::*)(<p1>, <p2>, ..., <pN>) const

Does anyone object to this fix?


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