aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2004-08-04 11:13:07 +0000
committerAndrew Haley <aph@gcc.gnu.org>2004-08-04 11:13:07 +0000
commit545eacdb4130cd64fb7cc5e4dd46e31b2753a18b (patch)
tree27d860db6287b5dbbb12712d0b8a9e24f0c075b5 /gcc/java
parentda96112d3497e41ffd0f7c2bfb7a236770d4244a (diff)
downloadgcc-545eacdb4130cd64fb7cc5e4dd46e31b2753a18b.zip
gcc-545eacdb4130cd64fb7cc5e4dd46e31b2753a18b.tar.gz
gcc-545eacdb4130cd64fb7cc5e4dd46e31b2753a18b.tar.bz2
typeck.c (convert_ieee_real_to_integer): Call fold on the range checking trees as they're being built.
2004-08-04 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. Co-Authored-By: Andrew Haley <aph@redhat.com> From-SVN: r85553
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/typeck.c39
2 files changed, 29 insertions, 18 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 1cd9315..015d89a 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,11 @@
+2004-08-04 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.
+
2004-08-02 Bryce McKinlay <mckinlay@redhat.com>
PR java/16701
diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c
index 1e1620a..289048e 100644
--- a/gcc/java/typeck.c
+++ b/gcc/java/typeck.c
@@ -83,22 +83,24 @@ convert_ieee_real_to_integer (tree type, tree expr)
tree result;
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);
+ 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;
}
@@ -131,8 +133,9 @@ convert (tree type, tree expr)
return fold (convert_to_boolean (type, expr));
if (code == INTEGER_TYPE)
{
- if (! flag_unsafe_math_optimizations
- && ! flag_emit_class_files
+ 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)
return fold (convert_ieee_real_to_integer (type, expr));