problem with unaligned access on Alpha
Christian Groessler
cpg@aladdin.de
Thu Jun 24 00:53:00 GMT 1999
On 6/23/99 6:35:21 PM Richard Henderson wrote:
>
>On Tue, Jun 22, 1999 at 11:59:46AM +0100, Christian Groessler wrote:
>> #define READ_WORD(a) (*(unsigned short *)(a))
>...
>> I would expect the "val=READ_WORD()" line to generate an unaligned
access
>> exception, but this doesn't happen.
>
>You expect incorrectly.
>
>In general you'll only get an unaligned access trap if we'd issued
>an `ldwu' instruction, which we can only do when compiling for EV56
>or higher.
I assume for shorts only. If I replace "unsigned short *" with "unsigned
int *"
I do get unaligned traps.
>> I looked at the generated assembler code (with my little only alpha
>> assembler knowledge), and it seems that the compiler is generating
>> code for unaligned access but somehow forgets to get the byte at
(adress+1).
>
>Nope, we're generating code for an _aligned_ word access in
>the only way that is possible on EV4. An unaligned word
>access doubles the length of the sequence.
Now I see. The code for aligned word access breaks when the
word is unaligned at address+7, if I understand the assembly code
correctly. My problem is/was, that the code breaks _silently_, but
maybe this case is hard to detect (to give a warning etc.).
Thanks for the info.
regards,
chris
More information about the Gcc
mailing list