By: draugaz (draugaz.delete@this.iname.com), October 30, 2006 12:31 pm
Room: Moderated Discussions
Ricardo B (ricardo.b@xxxxx.xx) on 10/30/06 wrote:
---------------------------
>>Mmm... Your code doesn't create an unaligned pointer, someBuffer will be first
>>cast to an int and then 10 * sizeof(int) will be added to it so you will end up
>>with an aligned int pointer albeit aliasing with a char pointer.
>
>Indeed, I meant:
>int32_t * someField = (int*)(someBuffer+10);
Try this on Sparc and you will get a nice aligment trap.
In contrast to the PowerPC or x86 it does not automatically handle such faults which means your process will die (provided it has no signal handler).
---------------------------
>>Mmm... Your code doesn't create an unaligned pointer, someBuffer will be first
>>cast to an int and then 10 * sizeof(int) will be added to it so you will end up
>>with an aligned int pointer albeit aliasing with a char pointer.
>
>Indeed, I meant:
>int32_t * someField = (int*)(someBuffer+10);
Try this on Sparc and you will get a nice aligment trap.
In contrast to the PowerPC or x86 it does not automatically handle such faults which means your process will die (provided it has no signal handler).