I'm trying to compile Ant and i ran into and error.  I simplified the code as 
much as possible while still producing the error.  It doesn't matter if you 
use gcj or Sun's javac (1.3.1) to compile.  And Sun's java will run the code 
without problem. 
 
Here's the code: 
interface fnm 
 { 
 int getInt(); 
 } 
 
class im1  
implements fnm 
 { 
 public int getInt() { return 1; } 
 } 
 
class im2 
implements fnm 
 { 
 public int getInt() { return 2; } 
 } 
 
public class test 
 { 
 public static void main( String[] Args ) 
  { 
  test T = new test(); 
  T.exec(); 
  } 
 
 public void exec() 
  { 
  fnm myMapper = new im1(); 
  if (Math.random() == 1.0d) 
   { 
   myMapper = new im2(); 
   } 
  System.out.println( myMapper.getClass().getName() ); // im1 
 // System.out.println( myMapper.getInt() ); // works 
 // this.select( myMapper );   // fails 
  } 
 
 public void select( fnm Mapper ) 
  { 
  System.out.println( Mapper.getInt() ); 
  } 
 } 
 
 
Here's the stack trace: 
Exception in thread "main" java.lang.VerifyError: verification failed at PC 26 
in test:exec(()V): incompatible type on stack 
   at _Jv_BytecodeVerifier.verify_fail(byte, int) (/usr/lib/libgcj.so.4.0.0) 
   at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib/libgcj.so.4.0.0) 
   at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib/libgcj.so.4.0.0) 
   at _Jv_PrepareClass(java.lang.Class) (/usr/lib/libgcj.so.4.0.0) 
   at java.lang.ClassLoader.linkClass0(java.lang.Class) 
(/usr/lib/libgcj.so.4.0.0) 
   at java.lang.ClassLoader.resolveClass0(java.lang.Class) 
(/usr/lib/libgcj.so.4.0.0) 
   at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.4.0.0) 
   at java.lang.Class.forName(java.lang.String, boolean, 
java.lang.ClassLoader) (/usr/lib/libgcj.so.4.0.0) 
   at java.lang.Class.forName(java.lang.String) (/usr/lib/libgcj.so.4.0.0) 
   at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.4.0.0) 
   at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.4.0.0) 
   at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) 
(/usr/lib/libgcj.so.4.0.0) 
   at __libc_start_main (/lib/libc-2.3.2.so)

-- 
           Summary: VerifyError, incompatible type on stack
           Product: gcc
           Version: 3.3.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brian_252 at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


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

Reply via email to