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

stack allocation


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]