This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Duplicate constructors generated
- From: Matthew Jones <matthewjones at vw1600e dot org dot uk>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 02 Feb 2006 10:22:40 +0000
- Subject: Duplicate constructors generated
I am seeing dupicated ctors & dtors in my object files. For large classes this
leads to considerable bloat. And debugging is a pain as only 1 version is
linked to the source, and we inevitably see the other one being called.
I found a previous question about this:
http://gcc.gnu.org/ml/gcc-help/2004-11/msg00158.html which exactly describes
what I am seeing, but the answer is not particularly relevant. I get this with
simple non-virtual classes:
This trivial code:
class A
{
public:
int a;
A ();
};
A::A (void) : a(0) {}
int main (void)
{
A a;
return 0;
}
Produces this object file:
0000002c T A::A()
00000000 T A::A()
U __eabi
00000058 T main
Mangled:
0000002c T _ZN1AC1Ev
00000000 T _ZN1AC2Ev
U __eabi
00000058 T main
Generated assembler for the 2 constructors is identical.
I couldn't find any gcc bugzilla reports on this, or reference to it in release
notes. In which version is it fixed?
Is there any way to stop it?
I found elusive references to -fcoalesce, but this is only for Apple versions of
gcc.
The original response refers to an ABI document. There are many of these in the
further reading section. Which one is relevant?!
gcc -v
Using built-in specs.
Configured with: /cygdrive/c/gnu/src/gcc-3.4.3/configure --target=powerpc-ibm-ea
bi --host= --prefix=/cygdrive/c/gcc-install --with-cpu=440 --enable-cxx-flags=-m
cpu=440 --with-headers=/cygdrive/c/gcc-install/powerpc-ibm-eabi/include --disabl
e-nls --enable-symvers=gnu --enable-languages=c,c++ --disable-shared --with-newl
ib
Thread model: single
gcc version 3.4.3
Can anyone shed more light on this ?! Thanks...
--
Matthew JONES
http://www.tandbergtv.com/