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]

Java: Fix PR 16701


This patch fixes PR 16701. fold_constant_for_init() recursively resolves other constants, but it didn't update the global current_class before calling resolve_field_access(). This resulted in access checks being performed from the wrong context.

No new libjava/jacks regressions.

OK to commit?

Bryce

2004-07-27  Bryce McKinlay  <mckinlay@redhat.com>

	PR java/16701
	* parse.y (fold_constant_for_init): Call resolve_field_access with
	correct current_class context.

Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.496
diff -u -r1.496 parse.y
--- parse.y	26 Jul 2004 11:15:09 -0000	1.496
+++ parse.y	28 Jul 2004 01:30:50 -0000
@@ -15969,16 +15969,15 @@
 	    }
 	  else
 	    {
-	      /* Install the proper context for the field resolution.
-		 The prior context is restored once the name is
-		 properly qualified. */
+	      /* Install the proper context for the field resolution.  */
 	      tree saved_current_class = current_class;
 	      /* Wait until the USE_COMPONENT_REF re-write.  FIXME. */
 	      current_class = DECL_CONTEXT (context);
 	      qualify_ambiguous_name (node);
+	      resolve_field_access (node, &decl, NULL);
+	      /* Restore prior context.  */
 	      current_class = saved_current_class;
-	      if (resolve_field_access (node, &decl, NULL)
-		  && decl != NULL_TREE)
+	      if (decl != NULL_TREE)
 		return fold_constant_for_init (decl, decl);
 	      return NULL_TREE;
 	    }

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