This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Fix demangler in symbol versioning
On Thu, Dec 04, 2003 at 08:04:01PM -0500, Ian Lance Taylor wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > > It could conceivably lead to incorrect output. I don't know. For
> > > example, if you call cplus_demangle ("i", DMGL_TYPES), you will get
> > > "int". So if there is an external variable named `i', it seems
> > > conceivable that the wrong thing would happen. I haven't thought
> > > about whether this could really happen, though.
> >
> > In that case, we have a regression with cxxfilt. The old one:
> >
> > # cxxfilt i
> > i
> >
> > The new one:
> >
> > # ./cxxfilt i
> > int
>
> What is ``the old one'' in this case?
>
> I think a c++filt built from any sources in 2003 will print `int' when
> passed `i'. Certainly I have one which does that.
The correct behaviour is to print 'i'.
Documentation of __cxa_demangle:
// Ambiguities are possible between extern "C" object names and
// internal built-in type names, e.g. "i" may be either an object
// named "i" or the built-in "int" type. Such ambiguities should
// be resolved to user names over built-in names. Builtin types
// are any single lower case character. Any other single
// character is not a mangled type so we can treat those the same
// here.
In other words, any single character input to c++filt should
print 'i' if you call __cxa_demangle().
--
Carlo Wood <carlo@alinoe.com>