[Bug optimization/5477] gcc 3.0.x reserves a large stack frame, but uses only some parts of it

bangerth at ices dot utexas dot edu gcc-bugzilla@gcc.gnu.org
Mon Jun 23 14:42:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5477



------- Additional Comments From bangerth at ices dot utexas dot edu  2003-06-23 14:14 -------
Subject: Re:  gcc 3.0.x reserves a large stack frame, but uses only some parts of it


>         subl    $12, %esp
>         pushl   $32
>         call    __console_putchar
>         addl    $16, %esp
> ...
>
> for a simple subroutine call (a snippet of the generated code from the
> attachment with gcc-3.3) with a single integer parameter is nowhere near
> optimal.  The 12 bytes that are reserved at the beginning are clearly
> unused, so the "subl $12,%esp" should be removed entirely and the "addl
> $16,%esp" should be adjusted to "addl $4,%esp".  But it seems that this
> obvious local optimization is not done due to problems detecting all unused
> stack slots. 

On some systems, stack frames have to be 16-byte aligned. I don't know whether 
this is the case here, but it would be the obvious explanation.

W.

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/



More information about the Gcc-bugs mailing list