Skip to content
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

Closed
DoDoENT opened this issue Mar 17, 2016 · 2 comments
Closed

Why is native code compiled with -fno-strict-aliasing? #27

DoDoENT opened this issue Mar 17, 2016 · 2 comments

Comments

@DoDoENT
Copy link

@DoDoENT DoDoENT commented Mar 17, 2016

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?

@DanAlbert

This comment has been minimized.

Copy link
Collaborator

@DanAlbert DanAlbert commented 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 DanAlbert closed this Mar 17, 2016
@DanAlbert

This comment has been minimized.

Copy link
Collaborator

@DanAlbert DanAlbert commented Mar 17, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.