public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/7482: gij verify error
@ 2002-08-03 16:56 jmr
0 siblings, 0 replies; 2+ messages in thread
From: jmr @ 2002-08-03 16:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 7482
>Category: java
>Synopsis: gij verify error
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Sat Aug 03 16:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: jmr@fulcrummicro.com
>Release: 3.3 20020801 (experimental)
>Organization:
>Environment:
System: Linux churchill 2.4.3-12 #1 Fri Jun 8 15:05:56 EDT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-threads=posix --prefix=/home/user/jmr/app/gcc --enable-shared --enable-languages=c++,java : (reconfigured)
>Description:
The gij verifier erroneously gives an error when run on the class
file resulting from the following code:
X.java:
public class X {
private interface I { }
private static class U implements I { }
private static class V implements I { }
private static I g(Object o) {
I i;
if (o == null)
i = new U();
else
i = new V();
return i;
}
public static void main(String[] args) {
System.out.println(g(null));
}
}
It will also fail if the inner classes are put in their own files,
so it's not an issue with inner classes.
I tried all four combinations of compiling the .java with gcj /
Sun's javac, and interpreting with gij / Sun's java. It failed
in both gij cases, but neither of the java cases, so I'm assuming
that the .class generation is ok on the part of both compilers.
>How-To-Repeat:
; gcj -C -v X.java
Reading specs from /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc/configure --enable-threads=posix --prefix=/home/user/jmr/app/gcc --enable-shared --enable-languages=c++,java : (reconfigured)
Thread model: posix
gcc version 3.3 20020801 (experimental)
/home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/jc1 X.java -quiet -dumpbase X.java -g1 -version -fsyntax-only -femit-class-files -o /dev/null
GNU Java version 3.3 20020801 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.2 20020713 (experimental).
Class path starts here:
./
/home/user/jmr/app/gcc/share/java/libgcj-3.3.jar/ (system) (zip)
; gij X
Exception in thread "main" java.lang.VerifyError: verification failed at PC 24 in X:g((Ljava.lang.Object;)LX$I;): incompatible return type
at java.lang.Throwable.Throwable(java.lang.String) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at java.lang.Error.Error(java.lang.String) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at java.lang.LinkageError.LinkageError(java.lang.String) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at java.lang.VerifyError.VerifyError(java.lang.String) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at _Jv_BytecodeVerifier.verify_fail(byte, int) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at _Jv_BytecodeVerifier.verify_instructions_0() (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at _Jv_VerifyMethod(_Jv_InterpMethod) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at _Jv_PrepareClass(java.lang.Class) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at java.lang.ClassLoader.linkClass0(java.lang.Class) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at java.lang.ClassLoader.resolveClass0(java.lang.Class) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at java.lang.Class.initializeClass() (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at java.lang.Class.forName(java.lang.String) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at gnu.gcj.runtime.FirstThread.run() (/home/user/jmr/app/gcc/lib/libgcj.so.3)
at _Jv_ThreadRun(java.lang.Thread) (/home/user/jmr/app/gcc/lib/libgcj.so.3)
; gij --version
gij (GNU libgcj) version 3.3 20020801 (experimental)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>Fix:
In this case, a workaround is to write
if (o == null)
return new U();
else
return new V();
instead. There may be more complex examples where coding around
the problem isn't as easy.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: java/7482: gij verify error
@ 2002-08-12 16:43 Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2002-08-12 16:43 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR java/7482; it has been noted by GNATS.
From: Tom Tromey <tromey@redhat.com>
To: <jmr@fulcrummicro.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/7482: gij verify error
Date: 12 Aug 2002 17:38:18 -0600
>>>>> "jmr" == jmr <jmr@fulcrummicro.com> writes:
jmr> The gij verifier erroneously gives an error when run on the class
jmr> file resulting from the following code:
I've investigated this. It is definitely a bug in the verifier.
The problem is that after merging we see Object on the stack -- but
this isn't compatible with the return value of the method. This is
due to a limitation in how we represent the type of items on the
stack.
One fix would be to adopt a workaround in the verifier's handling of
areturn similar to that used in invokeinterface. This fix would
require adding a runtime check to the interpreter.
Another choice would be to change the verifier's internal
representation of types and merging.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-08-12 23:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-03 16:56 java/7482: gij verify error jmr
2002-08-12 16:43 Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).