David S. Miller wrote:
> I know you think GCC is a pile of dogshit, in many ways I do too, but I
> think it's just as important to point out the good parts where they
> exist.
GCC is the strangest combination of utterly brilliant and brain-dead
stupid that I've ever seen... I've seen it do tail merges that took
my breath away, followed by this:
mov <mem1>,eax
mov eax,<mem2>
mov <mem1>,eax ; eax already contains mem1 you stupid compiler
ret
------
Chuck
Chuck Ebbert <[email protected]> writes:
> GCC is the strangest combination of utterly brilliant and brain-dead
> stupid that I've ever seen... I've seen it do tail merges that took
> my breath away, followed by this:
>
> mov <mem1>,eax
> mov eax,<mem2>
> mov <mem1>,eax ; eax already contains mem1 you stupid compiler
> ret
Not necessarily if mem2 == mem1 + 2. Consider this code:
#include <string.h>
int f(char* a, char* b)
{
int t;
memcpy(&t, a, sizeof(int));
memcpy(b, &t, sizeof(int));
memcpy(&t, a, sizeof(int));
return t;
}
"gcc -O2 -Wall -S test.c -fomit-frame-pointer" correctly generates:
f:
movl 4(%esp), %ecx
movl (%ecx), %eax
movl 8(%esp), %edx
movl %eax, (%edx)
movl (%ecx), %eax
ret
--
Peter Osterlund - [email protected]
http://w1.894.telia.com/~u89404340