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] |
I compiled with gcc -O0 -S option and the compiler produces the code that I cannot quite follow the stack frame layout strategy in gcc.
question1: Why the stack frame size is 56? observation: (1) compiler add 16 bytes padding before allocating storage for array buffer1 (2) buffer1 need 5 bytes. However, due to alignment issue, they seem to add 3 extra bytes. Thus, -24(%ebp) should point to buffer1[0].
Then, why they adding 16 bytes padding?
question2: Why gcc makes the stack frame bigger before
the function call printf?
subl $8, %esp
Does it related to printf? If it does, then could you explain why?
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |