This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Java] Call "fold" in convert_ieee_real_to_integer
- From: Andrew Haley <aph at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Ranjit Mathew <rmathew at gmail dot com>, java-patches at gcc dot gnu dot org, <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 23 Jul 2004 15:15:29 +0100
- Subject: [Java] Call "fold" in convert_ieee_real_to_integer
- References: <39399b9d04072022136608d324@mail.gmail.com><Pine.LNX.4.44.0407211514570.24992-100000@www.eyesopen.com>
Try this instead. I've no idea why it worked before!
Andrew.
2004-07-23 Roger Sayle <roger@eyesopen.com>
Andrew Haley <aph@redhat.com>
* typeck.c (convert_ieee_real_to_integer): Call fold on the range
checking trees as they're being built.
(convert): Call convert_ieee_real_to_integer if we're
converting a constant, even if we're writing a class file.
Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/typeck.c,v
retrieving revision 1.68
diff -p -2 -c -r1.68 typeck.c
*** typeck.c 21 Jul 2004 16:03:43 -0000 1.68
--- typeck.c 23 Jul 2004 14:08:35 -0000
*************** convert_ieee_real_to_integer (tree type,
*** 84,103 ****
expr = save_expr (expr);
! result = build3 (COND_EXPR, type,
! build2 (NE_EXPR, boolean_type_node, expr, expr),
! convert (type, integer_zero_node),
! convert_to_integer (type, expr));
!
! result = build3 (COND_EXPR, type,
! build2 (LE_EXPR, boolean_type_node, expr,
! convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))),
! TYPE_MIN_VALUE (type),
! result);
!
! result = build3 (COND_EXPR, type,
! build2 (GE_EXPR, boolean_type_node, expr,
! convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))),
! TYPE_MAX_VALUE (type),
! result);
return result;
--- 84,105 ----
expr = save_expr (expr);
! result = fold (build3 (COND_EXPR, type,
! fold (build2 (NE_EXPR, boolean_type_node, expr, expr)),
! convert (type, integer_zero_node),
! convert_to_integer (type, expr)));
!
! result = fold (build3 (COND_EXPR, type,
! fold (build2 (LE_EXPR, boolean_type_node, expr,
! convert (TREE_TYPE (expr),
! TYPE_MIN_VALUE (type)))),
! TYPE_MIN_VALUE (type),
! result));
!
! result = fold (build3 (COND_EXPR, type,
! fold (build2 (GE_EXPR, boolean_type_node, expr,
! convert (TREE_TYPE (expr),
! TYPE_MAX_VALUE (type)))),
! TYPE_MAX_VALUE (type),
! result));
return result;
*************** convert (tree type, tree expr)
*** 132,137 ****
if (code == INTEGER_TYPE)
{
! if (! flag_unsafe_math_optimizations
! && ! flag_emit_class_files
&& TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
&& TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
--- 134,140 ----
if (code == INTEGER_TYPE)
{
! if ((really_constant_p (expr)
! || (! flag_unsafe_math_optimizations
! && ! flag_emit_class_files))
&& TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
&& TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)