memcpy to an unaligned address

Mike Stump mrs@apple.com
Tue Aug 2 21:05:00 GMT 2005


On Aug 2, 2005, at 1:37 PM, Andrew Pinski wrote:
> No it is not,

:-)  Ah, yes, the old, we don't have pointers to unaligned types  
problem...  anyway, we can at least agree that this is a gapping hole  
people can drive trucks though in the type system, but I'm still  
claiming it isn't a feature on theoretic grounds.

:-(

Shaun, want to do up an entry in the manual describing this?  We have  
known about this for years and years, but, we don't do a good job  
communicating it to users.  Essentially, & doesn't work as one would  
expect on unaligned data, as it produces a pointer to an aligned  
object instead of a pointer to unaligned object.  Essentially, we  
don't have a type system that contains pointer to unaligned types.   
The compiler then goes on to make codegen choices based upon the fact  
that the data are known to be aligned, and bad things happen.



More information about the Gcc mailing list