diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc index bb67dca560b..cd3fd2fc8fb 100644 --- a/gcc/tree-ssa-math-opts.cc +++ b/gcc/tree-ssa-math-opts.cc @@ -2982,6 +2982,11 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple *stmt, if (to_mode == from_mode) return false; + /* For fixed point types, the mode classes could be different + so reject that case. */ + if (GET_MODE_CLASS (from_mode) != GET_MODE_CLASS (to_mode)) + return false; + from_unsigned1 = TYPE_UNSIGNED (type1); from_unsigned2 = TYPE_UNSIGNED (type2); optype = type1;