public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] variable length automatic arrays.
@ 2005-04-17 15:36 Billy
  2005-04-17 16:09 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Billy @ 2005-04-17 15:36 UTC (permalink / raw)
  To: eCos discussion

Short question:

Does eCos allocate dynamically sized arrays?

Longer version:

I'm worried about dynamic arrays under arm-elf-gcc 3.3.4.

Looks like our application code, at least, is being adversely
affected by this bug:

"gcc-3.3: Miscompiles automatic dynamic arrays"
http://lists.debian.org/debian-gcc/2004/07/msg00135.html

So we're going through our app hunting these down.  Upgrading
the compiler to 3.4 might fix it, but new parser fussiness
appears to be making that a more painful option than bughunting.

Does eCos code rely on this gcc feature?  Do we have
to audit eCos code for varlength automatic arrays
or just our app code?


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] variable length automatic arrays.
  2005-04-17 15:36 [ECOS] variable length automatic arrays Billy
@ 2005-04-17 16:09 ` Andrew Lunn
  2005-04-18 13:20   ` Nick Garnett
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2005-04-17 16:09 UTC (permalink / raw)
  To: Billy; +Cc: eCos discussion

On Sun, Apr 17, 2005 at 11:16:22AM -0400, Billy wrote:
> Short question:
> 
> Does eCos allocate dynamically sized arrays?
> 
> Longer version:
> 
> I'm worried about dynamic arrays under arm-elf-gcc 3.3.4.
> 
> Looks like our application code, at least, is being adversely
> affected by this bug:
> 
> "gcc-3.3: Miscompiles automatic dynamic arrays"
> http://lists.debian.org/debian-gcc/2004/07/msg00135.html
> 
> So we're going through our app hunting these down.  Upgrading
> the compiler to 3.4 might fix it, but new parser fussiness
> appears to be making that a more painful option than bughunting.
> 
> Does eCos code rely on this gcc feature?  Do we have
> to audit eCos code for varlength automatic arrays
> or just our app code?

eCos should not be using this feature. 

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] variable length automatic arrays.
  2005-04-17 16:09 ` Andrew Lunn
@ 2005-04-18 13:20   ` Nick Garnett
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Garnett @ 2005-04-18 13:20 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: Billy, eCos discussion

Andrew Lunn <andrew@lunn.ch> writes:

> On Sun, Apr 17, 2005 at 11:16:22AM -0400, Billy wrote:
> > Short question:
> > 
> > Does eCos allocate dynamically sized arrays?
> > 
> > Longer version:
> > 
> > I'm worried about dynamic arrays under arm-elf-gcc 3.3.4.
> > 
> > Looks like our application code, at least, is being adversely
> > affected by this bug:
> > 
> > "gcc-3.3: Miscompiles automatic dynamic arrays"
> > http://lists.debian.org/debian-gcc/2004/07/msg00135.html
> > 
> > So we're going through our app hunting these down.  Upgrading
> > the compiler to 3.4 might fix it, but new parser fussiness
> > appears to be making that a more painful option than bughunting.
> > 
> > Does eCos code rely on this gcc feature?  Do we have
> > to audit eCos code for varlength automatic arrays
> > or just our app code?
> 
> eCos should not be using this feature. 

The failure referred to in the Debian list seems to be only under
specific conditions with -mpreferred-stack-boundary=2, which only
applied to x86 targets.  The default value is 4, for 16 byte stack
alignment. This is also the stack alignment that eCos attempts to
maintain. So it it probably a good idea to remove that option.


On a general point, variable length auto arrays are a very bad idea in
embedded systems. It makes it very difficult to estimate stack usage,
which can result in stack overflow and memory corruption. Just say no.


-- 
Nick Garnett                                     eCos Kernel Architect
http://www.ecoscentric.com                The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-18 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-17 15:36 [ECOS] variable length automatic arrays Billy
2005-04-17 16:09 ` Andrew Lunn
2005-04-18 13:20   ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).