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


Bryce McKinlay writes:
 > 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.

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

I think you need to check the return value of resolve_field_access().
If resolve_field_access() fails returning error_mark_node, no-one has
initialized decl.

Maybe I'm mistaken.  Please check.

Andrew.


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