Bug 13378 - gcj compiling from jar files - verification error
gcj compiling from jar files - verification error
Status: NEW
Product: gcc
Classification: Unclassified
Component: java
3.4.0
: P2 normal
: ---
Assigned To: Not yet assigned to anyone
: ice-on-valid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-12-10 19:15 UTC by norbertf
Modified: 2005-07-23 22:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-04-17 18:18:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description norbertf 2003-12-10 19:15:13 UTC
It seems there still is a bytecode verifyer bug when compiling from jar-files. 
gcc version 3.4 20031203 (experimental)

gcj -fCLASSPATH=swt.jar:xerces.jar -c jface-standalone.jar -o
jface_standalone.oOpenStrategy.java: In class
`org.eclipse.jface.util.OpenStrategy$1':
OpenStrategy.java: In method
`org.eclipse.jface.util.OpenStrategy$1.handleEvent(org.eclipse.swt.widgets.Event)':
OpenStrategy.java:229: error: verification error at PC=480
OpenStrategy.java:229: error: loading local variable 2 which has unknown
type
org/eclipse/jface/resource/URLImageDescriptor.java: In class
`org.eclipse.jface.resource.URLImageDescriptor':
org/eclipse/jface/resource/URLImageDescriptor.java: In method
`org.eclipse.jface.resource.URLImageDescriptor.getImageData()':
org/eclipse/jface/resource/URLImageDescriptor.java:48: error:
verification error at PC=21
org/eclipse/jface/resource/URLImageDescriptor.java:48: error: loading
local variable 2 which has unknown type
org/eclipse/jface/resource/FileImageDescriptor.java: In class
`org.eclipse.jface.resource.FileImageDescriptor':
org/eclipse/jface/resource/FileImageDescriptor.java: In method
`org.eclipse.jface.resource.FileImageDescriptor.getImageData()':
org/eclipse/jface/resource/FileImageDescriptor.java:75: error:
verification error at PC=21
org/eclipse/jface/resource/FileImageDescriptor.java:75: error: loading
local variable 2 which has unknown type
make: *** [default] Error 1

The jar-files which caused the problem:
http://www.scheinwelt.at/~norbertf/gcj/tests/gcjverifybug_test.tar.gz

norbert
Comment 1 Andrew Pinski 2003-12-10 20:49:12 UTC
Confirmed (I cannot attach the file because it is over 1000KB.
Comment 2 Tom Tromey 2003-12-20 06:19:52 UTC
Is this a regression from 3.3?
If not, let's not mark it with target-milestone 3.4.0.
The gcj verifier has several known bugs, and we aren't likely
to fix them for 3.4.  In fact my plan is to replace this verifier
with the one from libgcj.
Comment 3 Andrew Pinski 2004-01-14 03:18:41 UTC
Not a regression and it looks like the verification is not going to be fixed for 3.4.
Comment 4 Ranjit Mathew 2005-03-09 09:11:44 UTC
(In reply to comment #0)
> 
> The jar-files which caused the problem:
> http://www.scheinwelt.at/~norbertf/gcj/tests/gcjverifybug_test.tar.gz

I could not download this file - can you please put it back in?

Mainline CVS now has GCJ using a new verifier that should fix
most verifier bugs.
Comment 5 postfach@nfrese.net 2005-03-09 09:39:54 UTC
Subject: Re:  gcj compiling from jar files - verification
	error

I put it here:
http://www.scheinwelt.at/~norbertf/files/gcj/other_tests/


On Wed, 2005-03-09 at 10:11, rmathew at gcc dot gnu dot org wrote:
> ------- Additional Comments From rmathew at gcc dot gnu dot org  2005-03-09 09:11 -------
> (In reply to comment #0)
> > 
> > The jar-files which caused the problem:
> > http://www.scheinwelt.at/~norbertf/gcj/tests/gcjverifybug_test.tar.gz
> 
> I could not download this file - can you please put it back in?
> 
> Mainline CVS now has GCJ using a new verifier that should fix
> most verifier bugs.
> 

Comment 6 Ranjit Mathew 2005-03-09 10:26:50 UTC
Thanks.

Now the verification errors are gone, but I'm still not 
able to build the package (with or without -findirect-dispatch):
-------------------------------- 8< -------------------------------- 
~/src/tmp/PR13378/gcjverifybug > make
/home/ranmath/src/gcc/build/gcc/gcj -B/home/ranmath/src/gcc/build/gcc/ -B/home/r
anmath/src/gcc/build/i686-pc-linux-gnu/libjava/ -I/home/ranmath/src/gcc/build/i6
86-pc-linux-gnu/libjava/libgcj-4.1.0.jar -L/home/ranmath/src/gcc/build/i686-pc-l
inux-gnu/libjava/.libs -findirect-dispatch -fCLASSPATH=swt.jar:xerces.jar -c jfa
ce-standalone.jar -o jface_standalone.o
org/eclipse/jface/util/OpenStrategy.java: In class 'org.eclipse.jface.util.OpenS
trategy$1':
org/eclipse/jface/util/OpenStrategy.java: In method 'org.eclipse.jface.util.Open
Strategy$1.handleEvent(org.eclipse.swt.widgets.Event)':
org/eclipse/jface/util/OpenStrategy.java:336: error: expected type 'java.lang.Ru
nnable[]' but stack contains 'java.lang.Object'
org/eclipse/jface/util/OpenStrategy.java:336: error: stack underflow
org/eclipse/jface/util/OpenStrategy$1.java:0: confused by earlier errors, bailin
g out
make: *** [default] Error 1
-------------------------------- 8< --------------------------------
Comment 7 Bryce McKinlay 2005-03-10 01:29:24 UTC
This is failing because the bytecode in this .jar really is broken:

public class Test
{
  public static void main(String[] args) throws Exception
  {
    Class f = Class.forName("org.eclipse.jface.util.OpenStrategy$1");
    System.out.println (f);
  }
}

$ java Test
Exception in thread "main" java.lang.VerifyError: (class:
org/eclipse/jface/util/OpenStrategy$1, method: handleEvent signature:
(Lorg/eclipse/swt/widgets/Event;)V) Register 2 contains wrong type
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)
        at Test.main(Test.java:7)

However, its questionable whether gcj should actually report this error with
--indirect-dispatch. The verifier is correctly deferring this type check to
runtime via a type assertion but code in expr.c is still doing its own check
(hangover from the old verifier, I guess). Then again its probably a reasonable
assumption to make that java.lang.Object is never assignment-compatible to
anything else.