Re: Alignment question, sparc-centric

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mark Fortescue <mark@xxxxxxxxxxxxxxxxxx>
Date: Sat, 2 Jun 2007 19:46:21 +0100 (BST)

> Some versions of GCC may be capable of sorting out the correct code
> but my experience is avoid the situation to start with by using code
> similar to memcpy (&x, &un_aligned_x, sizeof x).

This unfortunately doesn't work, if GCC decides the object is
small enough to copy inline, it will emit 32-bit and 64-bit
load and store instructions and still therefore take the
unaligned exceptions.

Types must be aligned on their natural size, and GCC can assume
this everywhere you reference such types unless you use the
"packed" GCC attribute.
-
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux