You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Why is native code compiled with -fno-strict-aliasing? #27
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?
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?
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.
Activity
DanAlbert commentedon Mar 17, 2016
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/
DanAlbert commentedon Mar 17, 2016
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.