This is the mail archive of the gcc@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]

Re: Question on unexpected asm output


On 04-Mar-2001, Tim Oertel <toertel@rpa.net> wrote:
> 
>    0: 83 ec 0c                sub    $0xc,%esp
>    3: e8 fc ff ff ff          call   4 <foobar0+0x4>
>    8: 83 c4 0c                add    $0xc,%esp
>    b: c3                      ret    
> 
> My question is why is there the extra sub and add?  I'd
> expect them if I had any locals, but I don't, and the
> extra stack allocated isn't even used.

The purpose of that is to keep the stack aligned to a 16-byte boundary.
For details, see the documentation of the `-mpreferred-stack-boundary='
option in the GCC manual.  You can use that option to override this behaviour.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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