Re: gcc forgets to decrease esp after function call

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

 



Vladimir Simonov writes:

 > Compiling some complex templated & inlined C++ code by gcc
 > 4.1.1/4.1.2 I've met a problem with -O2 optimization. Objdump'ed
 > text is below.
 > 
 > In line 30 the code calls method which returns object via shadow
 > pointer(in %esp). Calling function has "ret 4" at the end as it
 > should be.  But the problem code does not have "sub 0x4,%esp" to
 > fix esp after the call.
 > 
 > Obviously, codegenerator knows about calling function prototype(it
 > creates shadow parameter).  But by some reason it does not emit
 > "sub 0x4,%esp" and uses esp in line 41 as if esp's value is not
 > changed by called in line 30 function.  If I "sub 0x4,%esp" in line
 > 33 in gdb all is working fine.
 > 
 > Any hints about workarround the problem will be very appritiated.

I don't understand what you're complaining about.  The stack pointer
is not adjusted anywhere in the code you posted, except for the 

 >     6:   83 ec 3c                sub    $0x3c,%esp

at the beginning.  The generated code uses offsets from the stack
pointer, which doesn't change.  Where is esp's value changed by the
"called in line 30 function"?  Please show it.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux