-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is native code compiled with -fno-strict-aliasing? #27
Comments
Because at some point in the past someone thought they were smarter than the compiler. I actually discovered this while fixing a different bug the other day and cleaned it all up. In r12, I've removed all of the compiler options we were adding that really should just be the compiler's (or user's) decision: https://android-review.googlesource.com/#/c/207721/ |
If I had to guess, it was disabled because it does allow the compiler to make some rather surprising optimizations. A lot of developers do not well understand strict aliasing rules, so I guess the idea was that we were protecting people from bugs? It's honestly not a bad idea, and I considered keeping that flag, but I figure keeping compiler behavior consistent across platforms is better. |
I've noticed this being true for quite a long time (also in r10 and probably earlier).
Is there some problem with using
-fstrict-aliasing
when compiling native code? Are there any incompatibilities, undefined behaviour one should watch for when using this optimisation flag?The text was updated successfully, but these errors were encountered: