https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110170
--- Comment #2 from Antony Polukhin <antoshkka at gmail dot com> --- -fno-trapping-math had no effect Some tests with nans seem to produce the same results for both code snippets: https://godbolt.org/z/GaKM3EhMq