[Bug java/19921] New: wrong argument count for invokeInterface with new multidimensional array

kon at iki dot fi gcc-bugzilla@gcc.gnu.org
Sat Feb 12 16:35:00 GMT 2005


A GCC checked out on 2005-02-12 compiles the following Java
source to invalid bytecode.  This is a variation of code that
occurs in gnu.classpath.tools.gjdoc.Main.startDoclet.

interface I {
    void f(Object x);
}

class C {
    static void g(I i) {
        i.f(new Object[1][1]);
    }
}

$ gcj -C -v array.java
Using built-in specs.
Target: i386-pc-linux-gnu
Configured with: /home/kalle/src/FOREIGN-CVS/gcc/configure --prefix=/home/kalle
--exec-prefix=/home/kalle/i386-pc-linux-gnu --host=i386-pc-linux-gnu
--build=i386-pc-linux-gnu --with-x-toolkit=gtk
Thread model: posix
gcc version 4.0.0 20050212 (experimental)

/home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../libexec/gcc/i386-pc-linux-gnu/4.0.0/jc1 array.java -quiet -dumpbase array.java -auxbase-strip NONE -g1 -version
-fsyntax-only -femit-class-files -o /dev/null
GNU Java version 4.0.0 20050212 (experimental) (i386-pc-linux-gnu)
	compiled by GNU C version 4.0.0 20050129 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Class path starts here:
    ./
   
/home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../lib/gcc/../../../share/java/libgcj-4.0.0.jar/ (system) (zip)
$ ls -l
yhteensÃEUR 12
-rw-rw-r--  1 kalle kalle 113 2005-02-12 09:45 array.java
-rw-rw-r--  1 kalle kalle 303 2005-02-12 09:45 C.class
-rw-rw-r--  1 kalle kalle 123 2005-02-12 09:45 I.class
$ gij C
Exception in thread "main" java.lang.VerifyError: verification failed at PC 7
in C:g((LI;)V): wrong argument count for invokeinterface
   at _Jv_BytecodeVerifier.verify_fail(byte, int)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at _Jv_BytecodeVerifier.verify_instructions_0()
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at _Jv_VerifyMethod(_Jv_InterpMethod)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at _Jv_InterpreterEngine.do_verify(java.lang.Class)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at _Jv_Linker.verify_class(java.lang.Class)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at _Jv_Linker.wait_for_state(java.lang.Class, int)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at java.lang.VMClassLoader.resolveClass(java.lang.Class)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at java.lang.Class.initializeClass()
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at java.lang.Class.forName(java.lang.String)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at gnu.java.lang.MainThread.run()
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at _Jv_ThreadRun(java.lang.Thread)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean)
(/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgcj.so.6.0.0)
   at main (/home/kalle/stow/gcc/i386-pc-linux-gnu/lib/libgij.so.6.0.0)
   at __libc_start_main (/lib/libc-2.3.2.so)
   at _start
(/home/kalle/svn/y2004/lentoasema/trunk/bugit/GCC/x/../sysdeps/i386/elf/start.S:105)
$ jcf-dump -c C.class | grep invokeinterface
  7: invokeinterface <InterfaceMethod I.f (java.lang.Object)void> nargs:3
$ 

If I add more dimensions to the array, then gcj generates even more
extra arguments.

-- 
           Summary: wrong argument count for invokeInterface with new
                    multidimensional array
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kon at iki dot fi
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu


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



More information about the Gcc-bugs mailing list