I am using the compiler explorer (https://godbolt.org/) with default compiler settings (x86-64 gcc 6.3). The following code
int foo(int num) {
int a, b, c;
a = 1;
b = 2;
c = 3;
}
generates the assembly
foo(int):
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-20], edi
mov DWORD PTR [rbp-4], 1
mov DWORD PTR [rbp-8], 2
mov DWORD PTR [rbp-12], 3
nop
pop rbp
ret
It appears the stack pointer register rsp is never modified. Why is this? I thought local variables were pushed onto the stack, and that rsp would subsequently be modified (e.g. https://en.wikibooks.org/wiki/X86_Disassembly/Functions_and_Stack_Frames).