This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI
- From: "rmerkert at alphatech dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Nov 2003 00:05:20 -0000
- Subject: [Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12873
Summary: __cxa_demangle not working as specified in ABI
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rmerkert at alphatech dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: gcc (GCC) 3.4 20031026 (experimental)
This test program produces different results for 3.3.2 and 3.4.
cat > test.c <<EOF
#include <stdio.h>
#include <stdlib.h>
extern char *__cxa_demangle (const char *__mangled_name,
char *__output_buffer,
__SIZE_TYPE__ *__length,
int *__status);
int main(int argc, char** argv)
{
for (int i=1;i<argc;++i) {
int status;
char* res = __cxa_demangle(argv[i],0,0,&status);
if (res!=NULL || status!=0) {
printf("Demangled '%s' as '%s'\n",argv[i],res);
}
else {
printf("Could not demangle '%s'\n",argv[i]);
}
free(res);
}
return 0;
}
EOF
/local/gcc/bin/gcc -o test test.c -std=c99 /local/gcc/lib/libstdc++.a
'./test hello'
produces
Demangled 'hello' as 'unsigned char'
Also, if I don't pass the status flag pointer, then I get
Could not demangle 'hello'
Code is working in mainline, but it would be nice to have it work in 3.3
release series as well.
Can this be backported?