]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
widen mult: Fix handling of _Fract mixed with _Fract [PR119568]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 3 Mar 2026 21:57:47 +0000 (13:57 -0800)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Wed, 4 Mar 2026 12:32:37 +0000 (04:32 -0800)
The problem here is we try calling find_widening_optab_handler_and_mode
with to_mode=E_USAmode and from_mode=E_UHQmode. This causes an ICE (with checking only).
The fix is to reject the case where the mode classes are different in convert_plusminus_to_widen
before even trying to deal with the modes.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/119568

gcc/ChangeLog:

* tree-ssa-math-opts.cc (convert_plusminus_to_widen): Reject different
mode classes.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/tree-ssa-math-opts.cc

index bb67dca560b419d2bcbdeb6d3bb626eb1bad73d2..cd3fd2fc8fb4ce158466162648e3edbfcb218735 100644 (file)
@@ -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;