__builtin_memcpy and alignment assumptions

Jakub Jelinek jakub@redhat.com
Fri Jan 8 11:32:00 GMT 2016


On Fri, Jan 08, 2016 at 12:24:49PM +0100, Eric Botcazou wrote:
> > See some existing PR.  The GCC middle-end cannot assume that pointers
> > are aligned according to their type (while at least the C language would
> > support that notion).
> 
> Only on x86.  It could (and used to) do it on strict-alignment architectures.

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.

	Jakub



More information about the Gcc mailing list