diff --git a/gcc/match.pd b/gcc/match.pd index 3e54e2cf5a6..5adcd6bd02c 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4671,7 +4671,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (! FLOAT_TYPE_P (TREE_TYPE (@0)) || ! HONOR_NANS (@0)) { constant_boolean_node (true, type); } - (if (cmp != EQ_EXPR) + (if (cmp != EQ_EXPR + /* With -ftrapping-math conversion to EQ loses an exception. */ + && (! FLOAT_TYPE_P (TREE_TYPE (@0)) + || ! flag_trapping_math)) (eq @0 @0))))) (for cmp (ne gt lt) (simplify