public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* stack allocation
@ 2004-12-12 19:21 matt smith
  2004-12-16 19:08 ` jlh
  0 siblings, 1 reply; 4+ messages in thread
From: matt smith @ 2004-12-12 19:21 UTC (permalink / raw)
  To: gcc-help

This issue has been discussed in a few threads that I
have found on google but there was no conclusive
answer given for the phenomenon.  

example1.c

    void function(int a, int b, int c) {

           char buffer1[5];

           char buffer2[10];

}

void main() {

            function(1,2,3);

}

 

When you issue the "gcc -S -o example1.s example1.c"
command and view the function prolog you see that the
compiler reserves 40 bytes for these two arrays.  

subl $40, %esp

 

To me the expected behavior should be subl $24, %esp 
or in other words reserving 24 bytes of stack space.

 

Why the discrepancy? Thanks

Josh

 

 




		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 

^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <CAPhGq=bY8hS0DF2rf7_5E8ycYS52uJR8UH=Yjb0NiDBdaSR+6Q@mail.gmail.com>]

end of thread, other threads:[~2011-11-18 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-12 19:21 stack allocation matt smith
2004-12-16 19:08 ` jlh
     [not found] <CAPhGq=bY8hS0DF2rf7_5E8ycYS52uJR8UH=Yjb0NiDBdaSR+6Q@mail.gmail.com>
2011-11-18 17:57 ` Stack allocation Alexandru Juncu
2011-11-18 19:35   ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).