[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#141902: gcj-3.0: default constructor for inner class causes broken bytecode



retitle 141902 [fixed in gcj-3.1] default constructor for inner class causes broken bytecode
severity 141902 + fixed
thanks

Ben Burton writes:
> Package: gcj-3.0
> Version: 1:3.0.4-6
> Severity: normal
> 
> Hi.  I have the following piece of code that compiles correctly but then
> gives an error when run.  It involves calling a default constructor for
> an inner class.
> 
> If gcj won't accept this default constructor, it should give a compile
> error.  If gcj will accept this default constructor, it should run
> without errors.
> 
> Currently it compiles cleanly but produces broken bytecode; you don't
> have a clue that anything's wrong until you happen to run that
> particular piece of code.  This can be quite a problem in a large
> project where it becomes difficult to test the execution of every possible
> path through the software for compile breakages.
> 
>   public class Test {
>       public static void main(String[] args) {
>           new Test().sayHi();
>       }
> 
>       public void sayHi() {
>           new Foo().sayHi();
>       }
> 
>       private class Foo {
>           public void sayHi() {
>               System.out.println("Hi");
>           }
>       }
>   }
> 
> bab@espresso:/tmp> javac Test.java
> bab@espresso:/tmp> java Test
> Hi
> bab@espresso:/tmp> gcj -C Test.java
> bab@espresso:/tmp> java Test
> Exception in thread "main" java.lang.VerifyError: (class: Test$Foo,
> method: <init> signature: (LTest;)V) Expecting to find object/array on
> stack
>         at Test.sayHi(Test.java:10)
>         at Test.main(Test.java:6)
> 
> Thanks - Ben.
> 
> -- System Information
> Debian Release: 3.0
> Architecture: i386
> Kernel: Linux espresso 2.4.18-686 #2 Wed Mar 20 20:21:31 EST 2002 i686
> Locale: LANG=C, LC_CTYPE=C
> 
> Versions of packages gcj-3.0 depends on:
> ii  gcc-3.0                       1:3.0.4-6  The GNU C compiler.
> ii  gcc-3.0-base                  1:3.0.4-6  The GNU Compiler Collection (base 
> ii  java-common                   0.13       Base of all Java packages
> ii  libc6                         2.2.5-4    GNU C Library: Shared libraries an
> ii  libgcc1                       1:3.0.4-6  GCC support library.
> ii  libgcj2                       1:3.0.4-6  Java runtime library for use with 
> ii  libgcj2-dev                   1:3.0.4-6  Java development headers and stati
> ii  zlib1g                        1:1.1.4-1  compression library - runtime
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


-- 
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: