This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: fix compound assignment
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 10 Oct 2005 18:43:00 -0600
- Subject: [gcjx] Patch: FYI: fix compound assignment
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This fixes compound assignments, and as a result a few more
libjava.lang tests. It turns out you need to use stabilize_reference
in this case, not plain save_expr. I added this to my list of "tree
gotchas" in gcjx/TODO; I'll check that in later. This patch also
changes division to use handle_op_assignment, I missed that when
changing 'mod' earlier.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* tree.cc (handle_op_assignment): Special case RDIV_EXPR. Use
stabilize_reference, not save_expr.
(visit_op_assignment): Use handle_op_assignment.
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.58
diff -u -r1.1.2.58 tree.cc
--- tree.cc 11 Oct 2005 00:21:19 -0000 1.1.2.58
+++ tree.cc 11 Oct 2005 00:44:13 -0000
@@ -1580,7 +1580,7 @@
const ref_expression &rhs)
{
lhs->visit (this);
- tree lhs_tree = save_expr (current);
+ tree lhs_tree = stabilize_reference (current);
rhs->visit (this);
tree rhs_tree = current;
@@ -1600,6 +1600,8 @@
tree operation;
if (op == TRUNC_MOD_EXPR)
operation = build_mod (rhs_type, lhs_dup_tree, rhs_tree);
+ else if (op == RDIV_EXPR)
+ operation = build_divide (rhs_type, lhs_dup_tree, rhs_tree);
else
operation = build2 (op, rhs_type, lhs_dup_tree, rhs_tree);
TREE_SIDE_EFFECTS (operation) = (TREE_SIDE_EFFECTS (lhs_tree)
@@ -1638,19 +1640,7 @@
const ref_expression &lhs,
const ref_expression &rhs)
{
- lhs->visit (this);
- tree lhs_tree = save_expr (current);
- rhs->visit (this);
- tree rhs_tree = current;
-
- tree div_type = gcc_builtins->map_type (op->type ());
-
- current = build2 (MODIFY_EXPR, gcc_builtins->map_type (lhs->type ()),
- lhs_tree,
- build_divide (div_type, lhs_tree,
- rhs_tree));
- TREE_SIDE_EFFECTS (current) = 1;
- annotate (current, op);
+ handle_op_assignment (op, RDIV_EXPR, lhs, rhs);
}
void