Community
Participate
Working Groups
I'm using the current cvs head compiler to compile GNU Classpath. This compiler generates invalid bytecode for a particular file. I tried but I was unable to reduce the test case to something smaller. I'll attach the .class file. I'm happy to send a pointer to the source file as well, but I've been told before that you couldn't look at GPL (or even GPL+exception I suppose) sources... Here's the error messages from our bytecode verifier: ../../../../../trunk/libjava/classpath/java/text/RuleBasedCollator.java:312: error: verification failed at PC=239: stack sizes differ ../../../../../trunk/libjava/classpath/java/text/RuleBasedCollator.java:312: error: verification failed at PC=239: stack sizes differ ../../../../../trunk/libjava/classpath/java/text/RuleBasedCollator.java:312: error: verification failed at PC=239: unmergeable type I think the bug is that the result from the invokevirtual at PC=204 is not popped.
Created attachment 51382 [details] .class file, output of ecj
I'll investigate. Thanks Tom for the test case.
Tom, Would you have a test case to show the error? What version of the GNU Classpath are you trying to compile? Thanks.
I could successfully create an instance of your .class file type using reflect. So I definitely need a reproducable test case to track it down.
Sorry, I don't have a reduced test case. I tried to reduce the classpath code but wasn't able to make it fail :( I'm trying to compile the version of classpath on gcj's "gcj-eclipse" branch: http://gcc.gnu.org/viewcvs/branches/gcj-eclipse/libjava/ The particular file in question is: http://gcc.gnu.org/viewcvs/branches/gcj-eclipse/libjava/classpath/java/text/RuleBasedCollator.java?revision=114362&view=markup
Hmm... could the code be loading built-in RuleBasedCollator from your bootclasspath? Or do you think the bytecode in question is ok? I can attach a disassembly if that would help. By my reading the value pushed at PC=207 is never popped. This means that the branch from PC=185 to PC=239 "arrives" with an empty stack, but the fall-through case from PC=238 "arrives" with a 1-element stack -- and this violates a JVM constraint.
(In reply to comment #6) > Hmm... could the code be loading built-in RuleBasedCollator from > your bootclasspath? I used -Xbootclasspath/p: to add the current folder in which I had your version of the .class file. > Or do you think the bytecode in question is ok? I can attach > a disassembly if that would help. No, thanks. I can disassemble it using our own disassembler. > By my reading the value pushed at PC=207 is never popped. This means > that the branch from PC=185 to PC=239 "arrives" with an empty stack, > but the fall-through case from PC=238 "arrives" with a 1-element stack -- > and this violates a JVM constraint. Indeed. i'll try to reproduce it. What should I used to retrieve the code? cvs or svn?
This problem might be due to the optimization of unused locals. I'll dig more tomorrow, but on your side, try to recompile with -preserveAllLocals on the command line. It might work. Set severity to critical.
>This problem might be due to the optimization of unused locals. Feels like it is a different problem than bug 159021. The offending optimization wasn't producing non verifiable code. Just some <clinit> invocation side-effect were lost.
I also believe that this is a different issue than bug 159021. However my experiment yesterday makes me believe that it is related to the optimization of unused locals. I am trying to isolate the issue.
Created attachment 51407 [details] Proposed fix
Created attachment 51408 [details] Regression test
Thanks for persevering with this. I'll try the proposed patch today.
Created attachment 51409 [details] Proposed patch I would rather write it like this. Same end effect though.
What version do you want to release?
Tom, please wait that the fix is validated.
Created attachment 51412 [details] New patch Based on Philippe's patch
Created attachment 51413 [details] New regression tests
Released for 3.3M3. Regression test added in org.eclipse.jdt.core.tests.compiler.regression.CastTest#test042/043.
I updated and rebuilt, and the bug is now gone. Thanks for fixing this so quickly!
*** Bug 159822 has been marked as a duplicate of this bug. ***
+1 for 3.2.2 reopening
Tagged as 3.2.2
Released for 3.2.2. Added regression tests org.eclipse.jdt.core.tests.compiler.regression.CastTest#test041/42
Verified for 3.3 M3 using build I20061030-0010
Verified for 3.2.2 using build M20070112-1200.