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: Dale
Subject: Re: [avr-gcc-list] Stack use - possible bug
Date: Wed, 9 Jun 2010 15:35:49 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hi Paulo                                         >@2010.06.09_15:29:48_+0200

> 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.
> 

True. It shows the concept though.

> 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). :(
> 

Likewise, which is why I ended up with a crippled sample :-) The concept
is the same.

But you agree that there's stack used and never returned for reuse?

> -- 
> 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]