OSDN Git Service

PR java/28754:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Sep 2006 15:55:07 +0000 (15:55 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Sep 2006 15:55:07 +0000 (15:55 +0000)
* expr.c (expand_java_field_op): Initialize field's declaring
interface if necessary.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116890 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/java/ChangeLog
gcc/java/expr.c

index e7508bf..1df29cc 100644 (file)
@@ -1,5 +1,11 @@
 2006-09-12  Tom Tromey  <tromey@redhat.com>
 
+       PR java/28754:
+       * expr.c (expand_java_field_op): Initialize field's declaring
+       interface if necessary.
+
+2006-09-12  Tom Tromey  <tromey@redhat.com>
+
        PR java/28892:
        * expr.c (expand_java_field_op): No error for assignments not in
        class initializer or constructor.
index b08d33e..26cd7da 100644 (file)
@@ -2837,7 +2837,12 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
   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);
+    {
+      tree context = DECL_CONTEXT (field_ref);
+      if (context != self_type && CLASS_INTERFACE (TYPE_NAME (context)))
+       field_ref = build_class_init (context, field_ref);
+      field_ref = build_class_init (self_type, field_ref);
+    }
   if (is_putting)
     {
       flush_quick_stack ();