* [gcjx] Patch: FYI: fix compound assignment
@ 2005-10-11 0:49 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2005-10-11 0:49 UTC (permalink / raw)
To: Java Patch List
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-10-11 0:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-11 0:49 [gcjx] Patch: FYI: fix compound assignment Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).