This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: field initializer fix
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 23 Mar 2005 19:26:04 -0700
- Subject: [gcjx] Patch: FYI: field initializer fix
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
Lowering a field initializer incorrectly created a COMPONENT_REF.
This is incorrect as that is already done by mapping the field
reference. So, we remove this.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* tree.cc (visit_field_initializer): Don't build a COMPONENT_REF.
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.19
diff -u -r1.1.2.19 tree.cc
--- tree.cc 24 Mar 2005 02:26:32 -0000 1.1.2.19
+++ tree.cc 24 Mar 2005 02:27:42 -0000
@@ -1481,17 +1481,9 @@
gcc_builtins->lay_out_class (field->get_declaring_class ());
tree field_tree = gcc_builtins->map_field_ref (class_wrapper, this_tree,
field);
- tree lhs;
- if (field->static_p ())
- lhs = field_tree;
- else
- lhs = build3 (COMPONENT_REF, TREE_TYPE (field_tree),
- build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (this_tree)),
- this_tree),
- field_tree, NULL_TREE);
field->get_initializer ()->visit (this);
- current = build2 (MODIFY_EXPR, TREE_TYPE (field_tree), lhs, current);
+ current = build2 (MODIFY_EXPR, TREE_TYPE (field_tree), field_tree, current);
}
tree