Patch: RFA: Fix PR java/21844

Ranjit Mathew rmathew@gmail.com
Tue Jun 7 10:01:00 GMT 2005


Tom Tromey wrote:
> This fixes PR java/21844.
> 
> The problem occurs if we are making an outer reference to an inherited
> field.  In this case nested_field_access_p incorrectly returned false,
> and as a result we referenced the field against 'this' rather than
> 'this$0'.  (Seems like this could be caught by type checking code in
> some later pass, were it to exist.)

Sorry for this inadvertant breakage! :-(


> --- gcc/java/parse.y 6 Jun 2005 19:31:35 -0000 1.537
> +++ gcc/java/parse.y 6 Jun 2005 20:13:28 -0000
> @@ -8416,6 +8416,13 @@
>    if (type_root == decl_type_root)
>      return 1;
>  
> +  /* Before we give up, see whether it is a non-static field
> +     inherited from the enclosing context we are considering.  */
> +  if (!DECL_CONTEXT (TYPE_NAME (type_root))
> +      && !is_static
> +      && inherits_from_p (type_root, decl_type))
> +    return 1;
> +
>    return 0;

See parse.y:8393, which is *supposed* to handle the same
case. Before my patch, the "for" loop was peeking ahead
and handling this case. Perhaps you can correct the look
ahead at the mentioned line and retry?

Thanks,
Ranjit.

-- 
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web: http://ranjitmathew.hostingzero.com/



More information about the Java-patches mailing list