This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
constructors/destructors compiled twice
- From: KÃvesdi GyÃrgy <kgy at deverto dot hu>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 20 Jun 2007 18:36:02 +0200
- Subject: constructors/destructors compiled twice
Hi,
I would like to use C++ for 8-bit AVR CPUs, so saving space would be
important.
I found that the constructors and destructors always have two instances, which
are exactly the same. I tried it for X86, X86/64, M68k, and AVR platforms,
with the same result, so it is not platform-dependent.
Here is a disassembled example:
000000f8 <valami::valami()>:
f8: fc 01 movw r30, r24
fa: 84 e0 ldi r24, 0x04 ; 4
fc: 91 e0 ldi r25, 0x01 ; 1
fe: 91 83 std Z+1, r25 ; 0x01
100: 80 83 st Z, r24
102: 13 82 std Z+3, r1 ; 0x03
104: 12 82 std Z+2, r1 ; 0x02
106: 08 95 ret
00000108 <valami::valami()>:
108: fc 01 movw r30, r24
10a: 84 e0 ldi r24, 0x04 ; 4
10c: 91 e0 ldi r25, 0x01 ; 1
10e: 91 83 std Z+1, r25 ; 0x01
110: 80 83 st Z, r24
112: 13 82 std Z+3, r1 ; 0x03
114: 12 82 std Z+2, r1 ; 0x02
116: 08 95 ret
Is it possible to switch off this behavior?
Regards,
Gyorgy Kovesdi