Current AOSP source forces -fno-strict-aliasing into TARGET_thumb_CFLAGS and $(combo_target)RELEASE_CFLAGS, and includes some code that miscompiles without that flag.

Especially code making use of sockaddr_* structs is often incompatible with the optimizations enabled if the compiler can assume aliasing rules are followed strictly.

Thanks to the -Wstrict-aliasing and -Werror=strict-aliasing options in gcc, violating pieces of code are easy to spot, and typically fairly easy to fix, e.g.,667,673

If there's not enough time to fix all of them properly, adding -fno-strict-aliasing on a per-directory basis is a better workaround than just disabling valuable optimizations globally.

Linaro Android 2.3.7 currently contains 30+ patches to make global -fstrict-aliasing possible. (They need to be ported to ICS).

Platform/Android/StrictAliasing (last modified 2013-08-29 09:16:07)