On Wed, May 29, 2024 at 8:58 AM Rich Felker wrote: > existing > compilers all just wrongly reorder things with respect to fenv access > and break it and don't care to fix this (probably because it would hurt their benchmarks to fix it the right way). FWIW (not that it changes the recommendation in this instance), Clang has put a bunch of work into addressing this and other floating-point compliance issues over the past decade. It *is* considered an important thing to implement correctly, and I believe it generally is working on the common architectures, since a few years ago. Unfortunately it's not yet implemented on every architecture. There is no impact on benchmarks by implementing fenv correctly, because, per the C standard, it is undefined behavior to access the floating-point status flags or to execute any code with non-default floating-point control modes in effect unless "fenv_access" is enabled -- either using "#pragma STDC FENV_ACCESS ON" in the code, or via an implementation-defined mechanism to set the default to on (in clang, the command-line option "-ffp-model=strict"). Because it's opt-in, only the code which actually requires it takes the performance hit.