Re: Unaligned access question

From: Martin Pool <>
Date: 2003-09-25 12:23:11
On 25 Sep 2003, Ian Wienand <> wrote:
> Hi,
> This isn't directly related to kernel development, but I am a bit
> stumped as to why my test program below causes an unaligned access
> when 'i' is 7 (that is, when it tries to access across a 64 bit
> boundary of 'array').  It's counter intuitive to me, I would have
> expected it either fault on all loads (for every value of 'i') or to
> have not faulted at all.

I think adding

  __attribute__ ((aligned (1))) 

will make it read the structure in a way that can handle less-aligned
addresses.  (Or maybe 2-byte aligned.)  By default gcc assumes strong
alignment so that it can use faster operations (ld8 or something I

As Peter said unaligned access will not necessarily trap.


To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at

Received on Wed Sep 24 22:25:45 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:17 EST