https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102930
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Mon, 25 Oct 2021, vincent-gcc at vinc17 dot net via Gcc-bugs wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102930 > > --- Comment #3 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> --- > (In reply to Jakub Jelinek from comment #2) > > I think there is nothing that can be done about this, and something like > > this has been there since forever. While perhaps some double routines in > > glibc used to be at some point correctly roundded, many others (e.g. float > > or long double) never were, there is always a chance you get different > > results from compile time folding vs. runtime evaluation. > > In this case, for its optimizations, GCC shouldn't assume that these results > are equal. Indeed. It's fine that different executions of a call to such a function *in the abstract machine* return different values. But each execution of such a call in the abstract machine must return some particular value (possibly different for different executions); it's not valid to optimize the code in a way that's inconsistent with a single return value for each call to the function in the abstract machine. (Likewise for other cases discussed in other bugs such as out-of-range floating-point-to-integer conversions.)