Consider this program: public class iof { static class Z { static { System.out.println("init"); } } public static Object x () { return new Object(); } public static void main(String[] args) { System.out.println(x() instanceof Z); } } With gcj this prints "init". With the JDK it does not.
Confirmed.
Hmm, when compiled to native it works but not when using gij.
Note -noverify does not help with this case unlike PR 17021.
Testing a patch.
Subject: Bug 24321 Author: tromey Date: Wed Mar 1 16:01:34 2006 New Revision: 111603 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111603 Log: PR java/24321: * testsuite/libjava.lang/pr24321.java: New file. * testsuite/libjava.lang/pr24321.out: New file. * java/lang/natClass.cc (isInstance): Don't initialize class. (isAssignableFrom): Likewise. Added: trunk/libjava/testsuite/libjava.lang/pr24321.java trunk/libjava/testsuite/libjava.lang/pr24321.out Modified: trunk/libjava/ChangeLog trunk/libjava/java/lang/natClass.cc
Fix checked in to trunk. This may be a good 4.1.1 candidate.