avr-gcc-list
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]