memcpy to an unaligned address
Mike Stump
mrs@apple.com
Tue Aug 2 21:30:00 GMT 2005
On Aug 2, 2005, at 1:45 PM, Ian Lance Taylor wrote:
> That argument doesn't make sense to me. memcpy takes a void*
> argument, which has no presumed alignment.
The memcpy builtin uses the static type of the actual argument
(before conversion to void*), to gain hints about the alignments of
the data coming in. This is so that we can producing nice fast code
for 1-16 bytes objects. This is actually good. The real problem is
formation of the address of the member doesn't produce a pointer to
unaligned type, but rather a pointer to aligned type, this is the
part that is wrong. We'd have to add pointers to unaligned data to
our type system to fix it. That should be done, but is a hard/big
job, and no one has stepped forward to do it.
More information about the Gcc
mailing list