wrong mangled C++ function names

Julian v. Bock jabvwf@gmx.de
Thu Sep 28 15:27:00 GMT 2000


Hi!

When I compile the following code on a i686-pc-linux-gnu system with gcc
2.95.2 it generates a wrong function name.

------
class foo;
class bar;

void
func( foo&, bar&, foo&, foo& ) {}
------

gcc generates 
func__FR3fooR3barT0T0
instead of
func__FR3fooR3barN20

If the code is changed to
------
class foo;
class bar;

void
func( foo&, foo&, foo& ) {}
------
gcc generates (correctly)
func__FR3fooN20

This doesn't cause programs to fail to compile since gcc uses always the same
(correct or wrong) names, and the names are demangled correctly since T0T0 means
the same as N20.
However, Frost ( http://frost.flewid.de ), a compiler wrapper that generates code
for dispatching of virtual function arguments in C++ needs to access functions
directly in assembly language and expects that two following arguments of the
same type are always encoded as N2*.


verbose gcc output:
# g++ test.cc -S -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ test.cc /tmp/ccyjwRlk.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3
 /usr/local/include
 /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../i686-pc-linux-gnu/include
 /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cc1plus /tmp/ccyjwRlk.ii -quiet -dumpbase test.cc -version -o test.s
GNU C++ version 2.95.2 19991024 (release) (i686-pc-linux-gnu) compiled by GNU C version 2.95.2 19991024 (release).


Julian


More information about the Gcc-bugs mailing list