This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ecj] Patch: FYI: fix PR java/28089


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 ();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]