Re: Unaligned access question

From: Andreas Schwab <schwab_at_suse.de>
Date: 2003-09-25 18:32:25
Martin Pool <mbp@samba.org> writes:

> On 25 Sep 2003, Ian Wienand <ianw@gelato.unsw.edu.au> 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))) 

You cannot decrease alignment with the aligned attribute, for that you
need the packed attribute.  This sets alignment to 1, which you can
increase again with the aligned attribute.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Received on Thu Sep 25 04:33:22 2003

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