This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[ecj] Patch: FYI: fix PR java/28089
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 21 Jun 2006 11:57:53 -0600
- Subject: [ecj] Patch: FYI: fix PR java/28089
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcj-eclipse branch.
This fixes a bug in how we pick which class to initialize when
referencing a static field when compiling bytecode using the C++ ABI.
We want to initialize the field's declaring class -- not the
qualifying class.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
PR java/28089:
* expr.c (expand_java_field_op): Initialize field's declaring
class.
Index: expr.c
===================================================================
--- expr.c (revision 114816)
+++ expr.c (working copy)
@@ -2804,9 +2804,11 @@
}
field_ref = build_field_ref (field_ref, self_type, field_name);
- if (is_static
- && ! flag_indirect_dispatch)
- field_ref = build_class_init (self_type, field_ref);
+ if (is_static && ! flag_indirect_dispatch)
+ {
+ /* Initialize the declaring class of the field. */
+ field_ref = build_class_init (DECL_CONTEXT (field_ref), field_ref);
+ }
if (is_putting)
{
flush_quick_stack ();