From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1855 invoked by alias); 11 Nov 2004 16:32:33 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 1829 invoked by uid 48); 11 Nov 2004 16:32:32 -0000 Date: Thu, 11 Nov 2004 16:32:00 -0000 From: "brian_252 at yahoo dot com" To: java-prs@gcc.gnu.org Message-ID: <20041111163224.18430.brian_252@yahoo.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/18430] New: VerifyError, incompatible type on stack X-Bugzilla-Reason: CC X-SW-Source: 2004-q4/txt/msg00368.txt.bz2 List-Id: 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