[Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class

rmathew at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Mar 9 12:39:00 GMT 2005


------- Additional Comments From rmathew at gcc dot gnu dot org  2005-03-09 12:39 -------
The problem is that we leave out a call to _Jv_InitClass for a static
private method thinking that it is unreachable. This is not the case
for a private static inner class method. A simple pessimistic
fix is:

Index: decl.c
===================================================================
--- decl.c      2005-03-09 17:16:36.000000000 +0530
+++ decl.c      2005-03-09 17:17:18.000000000 +0530
@@ -2039,5 +2039,5 @@ finish_method (tree fndecl)
   /* Prepend class initialization for static methods reachable from
      other classes.  */
-  if (METHOD_STATIC (fndecl) && ! METHOD_PRIVATE (fndecl)
+  if (METHOD_STATIC (fndecl)
       && ! DECL_CLINIT_P (fndecl)
       && ! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (fndecl))))


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-03-05 23:20:15         |2005-03-09 12:39:24
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338



More information about the Gcc-bugs mailing list