Busybox 1.16.x dnsd alignment problems
Mike Frysinger
vapier at gentoo.org
Fri May 21 07:51:43 UTC 2010
On Wednesday 14 April 2010 13:14:07 Denys Vlasenko wrote:
> Are you saying that here:
>
> # define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
>
> memcpy may be opportunistic and if u16p has type uin16_t,
> memcpy will be optimized to assignment? If so, this
> should be prevented from happening. We WANT to be damn sure
> any address, however badly unaligned, will work in this macro.
this is correct behavior. gcc may assume the minalignment values based upon
the pointer type. if the pointer is assigned an address that does not satsify
the type's basic alignment requirements (e.g. uint16_t *p = 1), then that code
is broken and needs fixing.
most of the time, people start with void* with the unaligned pointer and then
memcpy/memmove it to a pointer/struct with the correct alignment.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20100521/42c5df29/attachment.pgp>
More information about the busybox
mailing list