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

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

Re: [avr-gcc-list] Stack use - possible bug


From: Paulo Marques
Subject: Re: [avr-gcc-list] Stack use - possible bug
Date: Wed, 09 Jun 2010 14:29:48 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Dale wrote:
> Hi                                  >@2010.06.09_14:42:49_+0200
> 
> Here's some code which shows this.

This code doesn't show a real bug, because even if the initialize
function weren't inlined, the stack would have to grow when calling it.
If you have enough RAM to support that, you have enough RAM to support
it being left there.

The real bug comes from gcc not reusing that space for other variables
afterwards, or calling other functions that might need that space
without releasing it first.

For instance, if you have another array in main but don't use it until
after you've called initialize, gcc should reuse the same space for the
main array too and not use 100 bytes of stack.

Sometimes this doesn't work correctly, but I wasn't able to produce a
simple case to show this problem (only very complex programs which I
didn't want to post online). :(

-- 
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"To know recursion, you must first know recursion."



reply via email to

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