I have compiled the following simple c++ code:
#include <iostream>
int main(){
int a = 5;
int b = 6;
long c = 7;
int d = 8;
return 0;
}
and here is the assembly:
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
xorl %eax, %eax
movl $0, -4(%rbp)
movl $5, -8(%rbp)
movl $6, -12(%rbp)
movq $7, -24(%rbp)
movl $8, -28(%rbp)
popq %rbp
retq
All the int
s have an allocation of 4 bytes which is normal. The long variable movq $7, -24(%rbp)
, is getting 12 bytes allocated to it (instead of 8) why is that?