Hi,
Consider this (simplified) test case:
int bar (int a)
{
int b;
memcpy (&b, &a, sizeof (int));
return b;
}
gcc 3.4.3 compiles this to (-O3 -fomit-frame-pointer)
bar:
movl 4(%esp), %eax
ret
But gcc 4.1.0 (and gcc 4.0.0 as well) generates:
bar:
subl $16, %esp
movl 20(%esp), %eax
addl $16, %esp
ret
The local variable is optimized away, so what's the point adjusting esp?
If I don't use memcpy, but a simple assignment, then both versions
produce the same
(good) code. Host and target are i386-redhat-linux.
Kimmo