This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix PR23230 - wrong code generated in inner class
- From: Andrew Haley <aph at redhat dot com>
- To: Robin Green <greenrd at greenrd dot org>
- Cc: java-patches at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 8 Aug 2005 14:05:07 +0100
- Subject: Re: [patch] Fix PR23230 - wrong code generated in inner class
- References: <20050805152201.GA6662@pob>
Robin Green writes:
> This one-liner fixes PR java/23230 by saying "if the inner class has a matching
> method, don't call a matching method in an outer class." In other words, always
> use the innermost scope.
>
> Tested against libjava/testsuite and jacks - no new failures (or passes). I'll
> submit a new test case to jacks.
>
> --
> Robin
>
> :ADDPATCH java:
>
> 2005-08-05 Robin Green <greenrd@greenrd.org>
>
> * maybe_use_access_method: Fix PR23230: Generalize check from
> java.lang.Object to any superclass of current_class
>
> --- gcc/java/parse.y.orig 2005-08-05 12:53:24.000000000 +0100
> +++ gcc/java/parse.y 2005-08-05 13:40:36.000000000 +0100
> @@ -10945,7 +10945,7 @@ maybe_use_access_method (int is_super_in
> invoking a static method. Note that if MD's type is unrelated to
> CURRENT_CLASS, then the current this can be used. */
>
> - if (non_static_context && DECL_CONTEXT (md) != object_type_node)
> + if (non_static_context && !inherits_from_p (current_class, DECL_CONTEXT (md)))
> {
> ctx = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (current_class)));
> if (inherits_from_p (ctx, DECL_CONTEXT (md)))
Good Lord, is it really as easy as that? Great stuff.
OK, thanks.
Andrew.