https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96862
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- What fold-const.c has is: /* Don't constant fold this floating point operation if the result may dependent upon the run-time rounding mode and flag_rounding_math is set, or if GCC's software emulation is unable to accurately represent the result. */ if ((flag_rounding_math || (MODE_COMPOSITE_P (mode) && !flag_unsafe_math_optimizations)) && (inexact || !real_identical (&result, &value))) return NULL_TREE; i.e. if the result is inexact, it punts with -frounding-math (or for IBM double double without -ffast-math). So are you suggesting that constexpr.c should temporarily disable flag_rounding_math during !allow_non_constant mode (or rather manifestly_const_eval || !allow_non_constant mode), perhaps directly in cxx_eval_outermost_constant_expr, on the basis that constant evaluation happens when the rounding mode couldn't be changed? For constant evaluation not required by the standard we need to still punt IMNSHO, as that is normally evaluated at runtime where it could be affected by rounding mode.