This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: java/5794: gcj fails to verify .class file generated by Sun JDK 1.4 compiler


>>>>> "Jesse" == Jesse Rosenstock <jmr@ugcs.caltech.edu> writes:

Jesse> pr=5794

Jesse> This problem bit me yesterday, and I want to compile something
Jesse> I don't have the source for, so I investigated it.

Thanks!  I've also been bitten by this problem recently, and it was on
my list to fix in the next few weeks.

Jesse> As previously discussed, I commented out the check that the
Jesse> exception handler target is outside of the range of the code
Jesse> the exception handler is for.  This is not dangerous, the worst
Jesse> it could cause is an infinite loop.

Also see Andrew's pending patch to turn this into a warning.  I think
his approach makes sense, since it is unlikely that such bytecode has
a useful meaning.

Jesse> According to my reading of
Jesse> http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#9801
Jesse> the instructions after the jsr's should never be verified.

I agree with your interpretation of the spec.  Mauve already has some
test cases for this (check out the `verify' module).  These were
distilled from actual bytecode I found while testing the libgcj
verifier.  It turns out that at least one popular compiler (I think
the IBM JDK 1.3 compiler) generates bytecode like this regularly.
(Sun's might do this too.)  So it isn't just a theoretical problem (as
you discovered).

Jesse> A patch follows, but I'm not sure of the patch.

Per will really have to review it.  He wrote the verifier in gcj and
remains the only person who fully understands it.  Meanwhile I'm going
to try your patch on the code I'm trying to build.  Thanks again.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]