https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79487
--- Comment #4 from Dominik Vogt <vogt at linux dot vnet.ibm.com> ---
What happens in Cse1 is that the constant is propagated into the FLOAT_EXTEND
expression, resulting in
(float_expand:DD (const_double:SD -9223372036854775808))
which is eventually simplified using simplify_const_unary_operation. This has
a case dealing with FLOAT_EXTEND:
case FLOAT_EXTEND:
/* All this does is change the mode, unless changing
mode class. */
/* Don't perform the operation if flag_signaling_nans is on
and the operand is a signaling NaN. */
if ((GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op))
|| d.decimal)
&& !(HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d)))
real_convert (&d, mode, &d);
break;
This test fails, so the following code just strips the FLOAT_EXTEND:DD and
replaces the mode in const_double with the target mode:
(const_double:DD -9223372036854775808)
which is wrong. Shouldn't this truncate the constant to the source mode first
before converting it to the target mode?