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]
Other format: [Raw text]

gcc memory reservation


i have a little problem ...

my testprogram:
------------------ start buffers.c -----------------------
void function(int a, int b, int c) {
   char buffer1[5];
   char buffer2[10];
}

void main() {
  function(1,2,3);
}
------------------ end buffers.c -----------------------

compiled with: gcc -S -o buffers.s buffers.c

in buffers.s i have the function() with:

function:
        pushl %ebp
        movl %esp,%ebp
        subl $40,%esp
        leave
        ret

now my question... how does gcc work out a number of 40 ??? i read some
about memory reservation and it said, it should reserve only 20 bytes:
buffer1 uses 8 bytes and buffer2 uses 12 bytes (always 4-byte words are
reserved).
so how can i know it will be 40 bytes that are reserved?


thanks in advance, aton


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