This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]