gcc forgets to decrease esp after function call

Vladimir Simonov Vladimir.Simonov@acronis.com
Fri Mar 9 15:59:00 GMT 2007


Hi again,

Ok, thank you.
I'll try to prepare minimal testcase. It is not so easy
because the problem apears while handling complex
templated code.

But I need advices about workarround the problem.
Say,
How can I force gcc to use ebp instead of
esp to address local variables?

How can I force gcc to use "leave"(ebp) on function return
instead of "add XXX, esp"?

If above is possible incorrect esp hanling may
be easy workarrounded.

Thank you in advance
Vladimir Simonov


Andrew Haley wrote:
> Vladimir Simonov writes:
>  > Hi
>  > 
>  > To be distinct.
>  > Here is the problem function.
> 
> OK, thanks, now it is clear.  The "ret 4" removes a word from the
> stack that belongs to the caller.
> 
> This is, as you say, definitely a code generation bug.  Now, we have a
> problem.  You would like it fixed, but you can't produce a test case
> that a gcc maintainer can use for a bug report.  If you can produce a
> test case we can see if tis is fixed in other gcc versions.
> 
> Andrew.
> 



More information about the Gcc-help mailing list