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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Re: zero length array in nocommon


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Re: zero length array in nocommon
Date: Mon, 28 Sep 2009 07:39:40 +0200 (MET DST)

"Weddington, Eric" <address@hidden> wrote:

> I'm on the gcc list. I would be very surprised if no one has noticed
> this behaviour, especially the CodeSourcery folks. Since it hasn't
> been brought up before, this is why I figure it is not a bug.

I don't accept that reasoning :), just because nobody notices
something doesn't mean it isn't a bug.  Remember, this is a
combination of two rarely used options: zero-length arrays outside
their main purpose (to emulate a variable-length array at the end of a
struct before C99 standardized them), and global uninitialized data
outside a common section.  Even then, someone would have to really
notice that the supposed to be zero-length variable has been assigned
a length of > 0.

Anyway, I tried to follow the code path in GCC, but cannot really make
my way through all of the variable allocation stuff.  common and
nocommon variables go a very different path beyond a certain point
when generating the assembly code.  It seems likely to me that it is
purely intentional that there is some kind of minimal variable size
emitted in nocommon mode.  In order to really know, the question would
have to be asked on the GCC developers list, in the hope to find
someone more acquainted with how all the variable allocation does
work.

I still think even if it's not a bug but an artifact of the way
variable allocation is done, at the very least it lacks a clear
statement in the documentation.  That alone might warrant a bug
report.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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