I am doing this course on x86-64 architecture and we are using virtual studio for that purpose, whether it's debugging or anything. So we have been given a code segment which is as follows:
int func() {
long long i = 0xf01dab1ef007ba11;
long long j = 0x0b57ac1e5;
return i+j;
}
int main() {
return func();
}
Now when I used the debugger this is the assembly instruction
I got and here is the stack diagram
for the same. Now if we see in the stack diagram at the address 00000000'0014FDD0
there is an extra 8 byte of allocations. I found the reason in the Microsoft docs and it states that The stack will always be maintained 16-byte aligned, except within the prolog (for example, after the return the address is pushed)... There are few exceptions though.
- Now here is another code segment
int func() {
long long i = 0xf01dab1ef007ba11;
long long j = 0x0b57ac1e5;
long long k = 0x57abbadabad00;
return i + j;
}
int main() {
return func();
}
And again this is the assembly instruction
and here is the stack diagram
for it. Now I understand that why there is an extra 8 bytes of allocation at the address 00000000'0014FED0
, which is to keep the stack 16-byte aligned.
But what I don't understand is why there is an extra allocation at the address `000000000'014FDC8? Is it necessary?