title: What kind of optimizations are included in -funsafe-math-optimizations?
body: <p>GCC's <a href="http://www.manpages.info/linux/gcc.1.html" rel="nofollow noreferrer">man page</a> states that <code>-funsafe-math-optimizations</code> allows for optimizations that "(a) assume that arguments and results are valid and (b) may violate IEEE or ANSI standards", but that's not very precise, is it?</p>
  
  <p>What could an "invalid" argument be in this case? NaNs? Infinites? Subnormals? Negative numbers to <code>sqrt()</code>?</p>
  
  <p>How far are results allowed to deviate from IEEE or ANSI standards? Is it "merely" stuff like <a href="https://stackoverflow.com/questions/6430448/why-doesnt-gcc-optimize-aaaaaa-to-aaaaaa">operation associativity and ordering</a>, or might it include eg. true comparisons with NaNs or incorrect comparisons with infinites? Could a stored variable be re-rounded after already being used (such that, for <em>variables</em> <code>x</code> and <code>y</code>, <code>(x == y) + (x == y)</code> could evaluate to 1)? Could <code>isinf()</code>/<code>isnan()</code> stop working?</p>
  
  <p>Do the GCC devs follow any particular system or discipline with regards to such questions, or could the answer differ wildly from version to version?</p>