https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94665
--- Comment #15 from Segher Boessenkool <segher at gcc dot gnu.org> --- replacing flag_unsafe_math_operations by flag_finite_math_only isn't correct, but you can add it instead, i.e. - if ((! FLOAT_MODE_P (mode) || flag_unsafe_math_optimizations) + if (!FLOAT_MODE_P (mode) + || (flag_unsafe_math_optimizations && flag_finite_math_only)) or such? Thanks for working on a patch!