|
From: Mark W. <mj...@re...> - 2015-09-14 09:32:30
|
On Mon, 2015-09-14 at 10:25 +0200, Florian Krohm wrote: > '-Wcast-align' > Warn whenever a pointer is cast such that the required alignment of > the target is increased. For example, warn if a 'char *' is cast > to an 'int *' on machines where integers can only be accessed at > two- or four-byte boundaries. > > So the warning is machine dependent. > From this page > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html > I gather that unaligned access is OK for ARMv6 and newer. > http://valgrind.org/info/platforms.html says we support ARMv7 so we > should be OK and can ignore those warnings. Perhaps your arm build was > on something older ? It was an armv7+. But GCC outputs the warning when the backend defines STRICT_ALIGNMENT to 1. Which arm does unconditionally. It does support some unaligned access and there is -munaligned-access (which defaults to 1 when on armv6+). But That seems to be only for some access or some instructions. I think this explains why: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4 Some unaligned accesses might still use instructions that don't support unaligned access and so trap into the kernel to adjust those. Which will slow down stuff a lot. So you still get a warning, just in case... Cheers, Mark |