On Tue, Apr 14, 2009 at 7:27 PM, Michael Ash <michael....@gmail.com> wrote: > I should specify, it has no trouble reading a misaligned int pointer > *in x86-64 mode*. I did actually test it that way, although the first > time I ran the test I compiled it 32-bit and then felt kind of > stupid....
You're right, I haven't been able to do it myself. Apparently you can set a flag to cause the CPU to generate alignment exceptions, but I can't seem to get it to happen: int main(int argc, const char *argv[]) { // Supposed to set the flag to cause // misalignment exception to bubble up asm("pushfq\n\t" "popq %rax\n\t" "orq $0x40000,%rax\n\t" "pushq %rax\n\t" "popfq"); unsigned long i = 18446744073709551615UL; char *x = (char *)(&i) + 1; int *y = (int *)x; (*y) += 2; return *x; } --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com