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


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

Patch: fix for gcj PR 162


I believe this patch fixes PR gcj/162.

I didn't understand why this code was checking DECL_LANG_SPECIFIC, and
that test was causing the condition to always fail, so I removed that.
Also, it seems to me that we must always initialize the field's
declaring class, not the class name as used by the program (which
might refer to a derived class, as in the PR).

Ok to commit?

2000-05-23  Tom Tromey  <tromey@cygnus.com>

	* parse.y (resolve_field_access): Don't check DECL_LANG_SPECIFIC
	when trying to see if field's class should be initialized.  Always
	initialize field's declaring class, not qualified class.
	For PR gcj/162.

Tom

Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.168
diff -u -r1.168 parse.y
--- parse.y	2000/05/20 22:38:05	1.168
+++ parse.y	2000/05/23 21:17:23
@@ -8604,7 +8604,6 @@
       is_static = JDECL_P (decl) && FIELD_STATIC (decl);
       if (FIELD_FINAL (decl) 
 	  && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
-	  && DECL_LANG_SPECIFIC (decl)
 	  && DECL_INITIAL (decl))
 	{
 	  field_ref = DECL_INITIAL (decl);
@@ -8618,7 +8617,7 @@
 	return error_mark_node;
       if (is_static && !static_final_found 
 	  && !flag_emit_class_files && !flag_emit_xref)
-	field_ref = build_class_init (type_found, field_ref);
+	field_ref = build_class_init (DECL_CONTEXT (decl), field_ref);
     }
   else
     field_ref = decl;

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