https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126469
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2026-07-29
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
```
/* Fold (double)float1 CMP (double)float2 into float1 CMP float2. */
(if (FLOAT_TYPE_P (TREE_TYPE (@00))
&& (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0))
== DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@00)))
&& (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0))
== DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@10))))
(with
{
tree type1 = TREE_TYPE (@10);
if (TREE_CODE (@10) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (type1))
{
REAL_VALUE_TYPE orig = TREE_REAL_CST (@10);
if (TYPE_PRECISION (type1) > TYPE_PRECISION (float_type_node)
&& exact_real_truncate (TYPE_MODE (float_type_node), &orig))
type1 = float_type_node;
if (TYPE_PRECISION (type1) > TYPE_PRECISION (double_type_node)
&& exact_real_truncate (TYPE_MODE (double_type_node), &orig))
type1 = double_type_node;
}
tree newtype
= (element_precision (TREE_TYPE (@00)) > element_precision (type1)
? TREE_TYPE (@00) : type1);
}
(if (element_precision (TREE_TYPE (@0)) > element_precision (newtype)
&& (!VECTOR_TYPE_P (type) || is_truth_type_for (newtype, type)))
(cmp (convert:newtype @00) (convert:newtype @10))))))))
```
This code has transition from fold to fold binary and then to a match pattern
but it was always wrong since it was added back in r0-47089-g77f9af81d26ddd .
Mostly because at the time there was no floating point types which has the same
precision but different representations.