public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: <jmr@fulcrummicro.com>
To: gcc-gnats@gcc.gnu.org
Subject: java/7482: gij verify error
Date: Sat, 03 Aug 2002 16:56:00 -0000	[thread overview]
Message-ID: <200208032348.g73Nm8H20028@churchill.internal.avlsi.com> (raw)


>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:


             reply	other threads:[~2002-08-03 23:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-03 16:56 jmr [this message]
2002-08-12 16:43 Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200208032348.g73Nm8H20028@churchill.internal.avlsi.com \
    --to=jmr@fulcrummicro.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).