This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fp->int folding broken. again.
- From: Richard Henderson <rth at twiddle dot net>
- To: roger at eyesopen dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 Oct 2003 00:22:00 -0700
- Subject: fp->int folding broken. again.
2003-10-03 Roger Sayle <roger@eyesopen.com>
PR optimization/9325, PR java/6391
* fold-const.c (fold_convert): For floating point to integer
conversions, return the maximum/minimum representable integer
value if the real constant overflows the destination type.
* tree.c (real_value_from_int_cst): Allow the type to be NULL,
meaning don't truncate the result to a floating point mode.
Simplify the logic by calling real_from_integer directly.
* simplify-rtx.c (simplify_unary_operation): Implement the
same semantics for folding floating point to integer conversions
in RTL.
I think we've done this about 10 times now.
We cannot bound conversion from float to integer at their signed bounds.
This breaks code within gcc that expects conversion to unsigned integer
to work. This patch causes
FAIL: gcc.c-torture/execute/conversion.c execution, -O3 -fomit-frame-pointer
FAIL: gcc.c-torture/execute/conversion.c execution, -O3 -g
FAIL: gcc.c-torture/execute/ieee/rbug.c execution, -O3 -fomit-frame-pointer
FAIL: gcc.c-torture/execute/ieee/rbug.c execution, -O3 -g
to fail on alpha-linux.
I don't care how this gets fixed, but every other time we've gone
round this hobby horse, we've decided that the saturation thing
just isn't worth it.
r~