http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56157
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-31 11:54:09 UTC --- Reduced testcase: struct Pixel { unsigned short r; unsigned short g; unsigned short b; unsigned short a; }; void fn(unsigned char *dst, const unsigned char *src, unsigned width) { unsigned x; for(x = 0; x < width; x += 1) { struct Pixel pixel; pixel.r = (unsigned short)(((unsigned)src[0]) * 0xffff / 0xff); pixel.g = (unsigned short)(((unsigned)src[1]) * 0xffff / 0xff); pixel.b = (unsigned short)(((unsigned)src[2]) * 0xffff / 0xff); pixel.a = (unsigned short)(((unsigned)src[3]) * 0xffff / 0xff); __builtin_memcpy(dst, &pixel, sizeof pixel); src += 4; dst += 8; } }