Reply 20 of 23, by frobme
Sigh. It's just amazing how important it is here for some people to get the last word. Yes, I read the examples. Yes, I get the differences. Yes, I've been working with GCC for more then ten years in a lot of environments, and I have personally had fast-math break on me in non floating point intensive code.
One of the best places to see the problems exemplified is the Gentoo repositories and forums; since it is regularly built on many different architectures and generally from source, they see quite a lot of compilation and linking bugs that most other single projects don't. You can search their bugzilla if you are curious. Or you could search KDE's bug backlog, which hates this flag.
I am simply pointing out that it has risks and questionable benefits on Intel architecture processors, hoping to save some people some trouble. If you are an on architecture that isn't optimized specifically against floats, the gains are quite substantial and much more worth any potential usage considerations.
The best rule for general optimization on GCC is to use -O2 and occasionally -O3 in combination with the appropriate -march flags, which picks an intelligent and well-proven set of sub flags automatically. In general the best additional improvement from there is not picking various flags that sound good but rather to do a profile guided opt with representative data.
-Frob