[ecj] PR612.java testsuite regression

Andrew Haley aph@redhat.com
Wed Jan 3 14:18:00 GMT 2007


I eventially tracked down this bug to a partial fix for PR java/28754.
We were doing double class initialization, and this is not just
unnecessary, it's incorrect.

We didn't see this as a testuite failure before because the _original_
fix for PR162 was incorrect, and it concealed the real bug by
generating incorrect class files.

Java is very subtle at times.

Andrew.


2007-01-03  Andrew Haley  <aph@redhat.com>

	PR java/28754
	* expr.c (expand_java_field_op): If we're initializing a field's
	declaring interface we should not also initialize the class
	context in which it was referenced.

Index: expr.c
===================================================================
--- expr.c	(revision 120352)
+++ expr.c	(working copy)
@@ -2892,7 +2892,8 @@
       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);
+      else
+	field_ref = build_class_init (self_type, field_ref);
     }
   if (is_putting)
     {



More information about the Java-patches mailing list