This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
stack allocation
- From: matt smith <infinite_south at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 12 Dec 2004 11:21:05 -0800 (PST)
- Subject: 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