Bug 248319 - [compiler][1.5] Valid Java source produces class file that doesn't verify (VerifyError, javac compiles correctly)
Summary: [compiler][1.5] Valid Java source produces class file that doesn't verify (Ve...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-23 13:53 EDT by Joachim Sauer CLA
Modified: 2008-10-28 06:09 EDT (History)
2 users (show)

See Also:
philippe_mulet: review+


Attachments
Proposed fix + updated regression tests (28.55 KB, patch)
2008-09-23 20:55 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Sauer CLA 2008-09-23 13:53:35 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1. Compile the following Class using Eclipse ecj:

public class Foo {
	public static void main(final String[] args) {
		new Foo().verifyError();
	}
	private Object verifyError() {
		try {
			if (someBooleanMethod()) {
				return null;
			}

			return getStuff();
		} catch (final Exception ex) {
			return null;
		} finally {
			while (someBooleanMethod()) {
				anyMethod();
			}
		}
	}
	private void anyMethod() {
		// do nothing
	}
	private Object getStuff() {
		return null;
	}
	private boolean someBooleanMethod() {
		return false;
	}
}

2. Try to run it (I tried it using Sun Java 1.5.0_15)
3. Get VerifyError instead of boring, no-output execution:

java.lang.VerifyError: (class: Foo, method: verifyError signature: ()Ljava/lang/Object;) Accessing value from uninitialized register 3


More information:
This is as far as I could break down the test case (the original code was much more complex). Now when I change anything the VerifyError goes away.
Comment 1 Olivier Thomann CLA 2008-09-23 14:19:11 EDT
Reproduced with HEAD with compliance 1.5.
Compliance 1.6 or 1.4 doesn't produce the problem.
I am investigating.
Comment 2 Olivier Thomann CLA 2008-09-23 20:55:38 EDT
Created attachment 113314 [details]
Proposed fix + updated regression tests
Comment 3 Olivier Thomann CLA 2008-09-23 20:56:07 EDT
Philippe, please review.
Comment 4 Philipe Mulet CLA 2008-10-02 11:50:06 EDT
Fix looks good.

Shouldn't we address it as well in 3.4.2 ? A verifyError due to StackMapTable sounds bad, since the code pattern is not that complex.
Comment 5 Olivier Thomann CLA 2008-10-14 12:04:12 EDT
Philippe, +1 for 3.4.2 ?
Comment 6 Olivier Thomann CLA 2008-10-14 12:06:35 EDT
Fixed and released for 3.5M3.
Updated existing regression tests.

Will reopen if this needs to be addressed for 3.4.2.
Comment 7 Frederic Fusier CLA 2008-10-28 06:09:40 EDT
Verified for 3.5M3 using build I20081026-2000.