Difference in __cxa_demangle between gcc 3.3 and 4.0

Yoav Gonen yoavg@humaneyes.com
Thu Nov 17 22:08:00 GMT 2005


Thanks for your quick response. Xcode 2.1 uses gcc 4.0.0 with target
powerpc-apple-darwin8. Xcode 2.2, using gcc 4.0.1, was just released and I'm
downloading it now. I'll check if this behavior is still present.

Thanks again,

-----Original Message-----
From: Ian Lance Taylor [mailto:ian@airs.com] 
Sent: Thursday, November 17, 2005 11:58 PM
To: Yoav Gonen
Cc: gcc-help@gcc.gnu.org
Subject: Re: Difference in __cxa_demangle between gcc 3.3 and 4.0

"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.


More information about the Gcc-help mailing list