This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Java] Call "fold" in convert_ieee_real_to_integer


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]