Posterous theme by Cory Watilo

What do do with EXC_ARM_DA_ALIGN on an iPhone app

Recently got the following nasty notices in a crash report on an iphone app:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: EXC_ARM_DA_ALIGN at 0x078e0032

Turns out that ARMv7, which is now compulsory, has memory alignment issues that ARMv6 didn't, so now people will probably see more of these issues.
Anyway, i could write about it, or i could post some links to helpful blogs:

Basically, replace code like this: 

destination = *((long *)unalignedPointer);

With this:

long tmp;
memcpy(&tmp, unalignedPointer, sizeof(tmp));
destination = tmp;