In a typical Ethernet/IP ARP header the source IP address is unaligned. Instead of using... out->srcIPAddr = in->dstIPAddr; ... I used... memcpy(&out->srcIPAddr, &in->dstIPAddr, sizeof(uint32_t)); ... to account for the unaligned destination. This worked until gcc 4, which now generates a simple load/store. ldr r3, [r6, #24] adds r2, r4, #0 adds r2, #14 str r3, [r2, #0] A nice optimisation, but in this case it's incorrect. $r4 is aligned, and the result of adding #14 to $r4 is an unaligned pointer.
Should gcc know better, or do I need to give it a little more information to help it out? Please cc me in your reply. Cheers, Shaun