__builtin_memcpy and alignment assumptions
Eric Botcazou
ebotcazou@libertysurf.fr
Fri Jan 8 11:40:00 GMT 2016
> I think we only assume it if the pointer is actually dereferenced, otherwise
> it just breaks too much code in the wild. And while memcpy dereferences,
> it dereferences it through a char * cast, and thus only the minimum
> alignment is assumed.
Yet the compiler was generating the expected code for Steve's testcase on
strict-alignment architectures until very recently (GCC 4.5 IIUC) and this
worked perfectly.
The irony of this very questionable change is that it was made to support some
corner cases with SSE on x86 but of course the compiler generates the expected
code for Steve's testcase on x86 because it is _not_ strict-alignment...
--
Eric Botcazou
More information about the Gcc
mailing list