When I compile this piece of code
unsigned char A[] = {1, 2, 3, 4};
unsigned int
f (unsigned int x)
{
return A[x];
}
gcc outputs
mov edi, edi
movzx eax, BYTE PTR A[rdi]
ret
by machine x86_64.
The question is: why does the nop instruction (mov edi, edi) exist for?
I am using gcc-4.4.4.
source
share