On Wednesday 01 October 2008, Martin Guy wrote: > If you don't want to make the code portable and your are running a > recent Linux, a fast fix is to > echo 2 > /proc/cpu/alignment > which should make the kernel trap misaligned accesses and fix them up > for you, with a loss in performance of course. The real answer is to > fix the code...
...and this is where -Wcast-align should help. The OP should also have a look at -Wpadded and -Wpacked, because this may expose similar pitfalls. This writeup looks like a good start for the OP: http://lecs.cs.ucla.edu/wiki/index.php/XScale_alignment