http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59990
Bug ID: 59990 Summary: [4.7/4.8/4.9 regression] incorrect memcpy optimization Product: gcc Version: 4.7.3 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: ebotcazou at gcc dot gnu.org Target: i?86-*-* This is a regression introduced in the 4.7.x series of compilers, visible on x86 but probably reproducible on other platforms. If you compile: extern void abort (void); unsigned char value[4] = { 66, 9, 160, 255 }; int main (void) { volatile float f; unsigned char a[4]; __builtin_memcpy ((void *)&f, value, 4); __builtin_memcpy (a, (void *)&f, 4); if (a[2] != 160) abort (); return 0; } with optimization enabled, it aborts at run time because FP instructions are incorrectly used to implement the memcpy operations.