<div dir="ltr">Finding which code is responsible for violating -ffast-math assumptions is a very tedious task that I do not wish to anybody.<div><br></div><div><div>Right now when a fast-math assumption is violated the only way I have to debug it is to disable fast math, and step-by-step try each of the more fine grained math optimizations until I find the minimal combination that reproduces the issue. This typically allows me to guess which kinds of operations I should be looking for, and start bisecting. Needles to say this is extremely time consuming. There must be a better way.</div><div><br></div>I would like the behavior of all my programs to not change _much_ under the influence of fast math. The only way to achieve this is to manually perform the transformations that fast math is going to perform, like exploiting associativity, and obviously, never violate any of fast-math assumptions. <br><br>It would be nice to have a warning that detects e.g. associativity transformations, and suggest how to rewrite them to minimize difference in the results between a program compiled with and without fast-math. </div><div><br></div><div>There is a tool called Herbie [0] that is used by the rust-herbie-lint [1] (worht seeing in action) to improve the accuracy and stability of mathematical operations so maybe something similar could be done to detect some of the transformations that fast-math does and suggest them to the user.</div><div><div><br></div><div>At run-time I would like some kind of fast-math sanitizer that catches all cases in which fast-math assumptions are violated (signaling nans, signed zeros, ...). Since the undefined-behavior sanitzer already covers e.g. division by zero, maybe a fast-math check would belong there as well.<br><br>[0] <a href="http://herbie.uwplse.org/">http://herbie.uwplse.org/</a><br>[1] <a href="https://github.com/mcarton/rust-herbie-lint">https://github.com/mcarton/rust-herbie-lint</a><br></div></div></div>