Difference in __cxa_demangle between gcc 3.3 and 4.0
Ian Lance Taylor
ian@airs.com
Thu Nov 17 21:57:00 GMT 2005
"Yoav Gonen" <yoavg@humaneyes.com> writes:
> I'm not sure this is the right place to ask, but here goes.
> I'm compiling the following program:
>
> #include <iostream>
> #include <cxxabi.h>
>
> int main(int argc, char * const argv[]) {
> size_t length;
> int status;
> char* p = abi::__cxa_demangle("d", 0, &length, &status);
> if (p) free(p);
> return 0;
> }
>
> I'm checking the values of status and p before freeing it.
> On gcc 3.3, status = 0 and p = "double".
> On gcc 4.0, status = -2 and p = NULL.
>
> Is this a bug?
>
> BTW, I'm using Xcode 2.1 on a Mac OS X 10.4.
There was a time that the demangler acted as you describe. However,
it was fixed for the 4.0 release (the demangler was originally changed
to follow the spec for __cxa_demangle, but the spec was determined to
be buggy, and both were changed back). I don't know anything about
Xcode 2.1. If you are seeing this behaviour with the FSF version of
gcc 4.0, then you have found a bug.
Ian
More information about the Gcc-help
mailing list