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]
Other format: [Raw text]

[patch] Fix PR23230 - wrong code generated in inner class


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

Attachment: pgp00000.pgp
Description: PGP signature


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