This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: handle comparisons correctly
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 26 Mar 2005 19:45:20 -0700
- Subject: [gcjx] Patch: FYI: handle comparisons correctly
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
We gave the wrong result type to comparison expressions.
This fixes that.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* tree.hh (tree_generator::binary_operator): Updated.
* tree.cc (binary_operator): Added result_type argument.
(visit_comparison): Updated.
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.26
diff -u -r1.1.2.26 tree.cc
--- tree.cc 27 Mar 2005 02:46:45 -0000 1.1.2.26
+++ tree.cc 27 Mar 2005 02:47:58 -0000
@@ -1003,14 +1003,16 @@
tree_generator::binary_operator (model_element *element,
tree_code code,
const ref_expression &lhs,
- const ref_expression &rhs)
+ const ref_expression &rhs,
+ tree result_type)
{
lhs->visit (this);
tree lhs_tree = current;
rhs->visit (this);
tree rhs_tree = current;
- current = build2 (code, gcc_builtins->map_type (lhs->type ()),
- lhs_tree, rhs_tree);
+ if (result_type == NULL_TREE)
+ result_type = gcc_builtins->map_type (lhs->type ());
+ current = build2 (code, result_type, lhs_tree, rhs_tree);
TREE_SIDE_EFFECTS (current) = (TREE_SIDE_EFFECTS (lhs_tree)
|| TREE_SIDE_EFFECTS (rhs_tree));
annotate (current, element);
@@ -1410,7 +1412,7 @@
const ref_expression &lhs,
const ref_expression &rhs)
{
- binary_operator (elt, EQ_EXPR, lhs, rhs);
+ binary_operator (elt, EQ_EXPR, lhs, rhs, type_jboolean);
}
void
@@ -1418,7 +1420,7 @@
const ref_expression &lhs,
const ref_expression &rhs)
{
- binary_operator (elt, NE_EXPR, lhs, rhs);
+ binary_operator (elt, NE_EXPR, lhs, rhs, type_jboolean);
}
void
@@ -1426,7 +1428,7 @@
const ref_expression &lhs,
const ref_expression &rhs)
{
- binary_operator (elt, LT_EXPR, lhs, rhs);
+ binary_operator (elt, LT_EXPR, lhs, rhs, type_jboolean);
}
void
@@ -1434,7 +1436,7 @@
const ref_expression &lhs,
const ref_expression &rhs)
{
- binary_operator (elt, GT_EXPR, lhs, rhs);
+ binary_operator (elt, GT_EXPR, lhs, rhs, type_jboolean);
}
void
@@ -1442,7 +1444,7 @@
const ref_expression &lhs,
const ref_expression &rhs)
{
- binary_operator (elt, LE_EXPR, lhs, rhs);
+ binary_operator (elt, LE_EXPR, lhs, rhs, type_jboolean);
}
void
@@ -1450,7 +1452,7 @@
const ref_expression &lhs,
const ref_expression &rhs)
{
- binary_operator (elt, GE_EXPR, lhs, rhs);
+ binary_operator (elt, GE_EXPR, lhs, rhs, type_jboolean);
}
void
Index: tree.hh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.hh,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 tree.hh
--- tree.hh 27 Mar 2005 02:46:45 -0000 1.1.2.7
+++ tree.hh 27 Mar 2005 02:47:58 -0000
@@ -115,7 +115,7 @@
tree arith_shift (model_element *, tree_code, const ref_expression &,
const ref_expression &, bool);
void binary_operator (model_element *, tree_code, const ref_expression &,
- const ref_expression &);
+ const ref_expression &, tree = NULL_TREE);
tree build_jni_stub ();
tree handle_string_literal (const std::string &);
tree build_int (jint, tree = NULL_TREE);