Incorrect C++ name mangling in egcs 1.1.2

Malte Zoeckler zoeckler@zib.de
Thu Jun 24 01:57:00 GMT 1999


Hi, 
it seams that egcs 1.1.2 does incorrect name mangling:
Compile this program:

///////////////////////////////////////

class A{
 public:
    void        setValues(int start, int num, const float xy[][2]);
};

void A::setValues(int, int, const float xy[][2])
{
}
////////////////////////////////////////

Then nm on the resulting .o file gives:
00000000 T setValues__1AiiPA1_Cf
which c++filt translates to 
 A::setValues(int, int, float const (*)[1])
                                        ^ a 1 instead of 2

Apart from beeing a potential bug, this is a problem, 
since it is not compatible with older
libraries I have to use and I have no source access to.

Although I don't think you'll need it, here is all 
the formal stuff:

 [bzfzoeck@peanut benchmark]$ g++ -v --save-temps -c test.c
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__
-Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__
-D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix)
-D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386
-D__i386 -D__i386__ test.c test.ii
GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-2
 /usr/i386-redhat-linux/include
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cc1plus test.ii -quiet
-dumpbase test.cc -version -o test.s
GNU C++ version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
(i386-redhat-linux) compiled by GNU C version egcs-2.91.66
19990314/Linux (egcs-1.1.2 release).
 as -V -Qy -o test.o test.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version
2.9.1.0.23


The test.ii is identical with the above file.

I am looking forward to hearing from you,

Best regards, Malte Zoeckler


More information about the Gcc-bugs mailing list