[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] zero length array in nocommon
From: |
Ruud Vlaming |
Subject: |
[avr-gcc-list] zero length array in nocommon |
Date: |
Wed, 23 Sep 2009 12:40:08 +0200 |
User-agent: |
KMail/1.9.1 |
Hi,
I noticed a strange behaviour when you place a zero length array in
'nocommon'. For example, if you use something like
const unsigned char TEST_C[0];
it compiles (assuming NO settings like -ffunction-sections -Wl,--gc-sections
-Wl,--relax) to
*(COMMON)
COMMON 0x000000000080007e 0x23 ./src/femtoos_shared.o
0x000000000080007e TEST_C
0x000000000080007e tcb00
so indeed it takes no space. However, if you use:
const unsigned char TEST_C[0] __attribute__ ((nocommon));
you get
.bss 0x0000000000800062 0x1d ./src/femtoos_shared.o
0x0000000000800076 TEST_C
0x0000000000800077 Stack00
and now it starts taking one byte of space. It looks like it is
somehow switching back to "old C" behaviour. (I know these
listings are not entirely conclusive, but i verified it is indeed
one byte extra)
Does anybody understands this?
Ruud
- [avr-gcc-list] zero length array in nocommon,
Ruud Vlaming <=
- Re: [avr-gcc-list] zero length array in nocommon, Joerg Wunsch, 2009/09/23
- Re: [avr-gcc-list] zero length array in nocommon, Ruud Vlaming, 2009/09/23
- Re: [avr-gcc-list] zero length array in nocommon, Dave Hylands, 2009/09/23
- Re: [avr-gcc-list] zero length array in nocommon, bleverett, 2009/09/23
- RE: [avr-gcc-list] zero length array in nocommon, Weddington, Eric, 2009/09/23
- Re: [avr-gcc-list] zero length array in nocommon, Ruud Vlaming, 2009/09/24
- RE: [avr-gcc-list] zero length array in nocommon, Weddington, Eric, 2009/09/24
- Re: [avr-gcc-list] zero length array in nocommon, Joerg Wunsch, 2009/09/24
- Re: [avr-gcc-list] zero length array in nocommon, Ruud Vlaming, 2009/09/24
- [avr-gcc-list] Re: zero length array in nocommon, David Brown, 2009/09/24