stack allocation

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

 



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 
 


[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