This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ mangle bugs, anyone?
- To: carlo at alinoe dot com (Carlo Wood)
- Subject: Re: C++ mangle bugs, anyone?
- From: Joe Buck <jbuck at synopsys dot COM>
- Date: Mon, 12 Mar 2001 16:16:25 -0800 (PST)
- Cc: gcc at gcc dot gnu dot org
> More than a week ago I posted an article about a bug in the (C++)
> mangler, requesting a discussion. Nobody reacted at all.
Name mangling issues are serious, but I suspect that Those Who Know are
very busy with other problems.
> 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).
It is true that it is important that we don't change the name mangling
after 3.0. But since we still can't even build libstdc++-v3 on some
platforms, other things still have higher priority. 3.0 is still a
ways off because of problems like this. If people haven't replied it
is probably because they are busy.
> 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.
I'm sure that the C++ maintainers will welcome it if you come up with
a patch. But we do need to make sure that any external constraints
(e.g. agreements with externally imposed standards) are met, and that
if there is any breakage in those standards that it gets fixed.
> --
> 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?
>