Bug 38345 - VerifyError, Inconsistent stack height with try/switch/if combination
Summary: VerifyError, Inconsistent stack height with try/switch/if combination
Status: RESOLVED DUPLICATE of bug 37621
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.0 M1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-02 16:08 EDT by Jim Hugunin CLA
Modified: 2003-06-03 05:17 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Hugunin CLA 2003-06-02 16:08:36 EDT
When compiled and run under eclipse-2.1, the program below will produce:
java.lang.VerifyError: (class: TrySwitch, method: m signature: (I)I) 
Inconsistent stack height 0 != 1
---------------------------------------------------
public class TrySwitch {
	public static void main(String[] args) throws Throwable {
		m(10);
	}
	
	static boolean done = true;
	static int m(int i) {
		try {
			switch(i) {
				default: return 10;
				case 10:
					if (false) { 
						break;
					} else {
						throw new RuntimeException();
					}
				case 11: break;
			}
		} catch (Throwable e) {
			System.err.println("caught: " + e);
		}
		return 33;
	}
}
---------------------------------------------------

This is the smallest test case I could create which replicates the original 
bug.  The original code is generated by the JACK Java agent tool so simple 
workarounds like removing the silly "if (false)" are very hard to apply in 
practice.

This bug was originally submitted by Feilong Chen [mailto:f0c5023@cs.tamu.edu] 
as a bug in the AspectJ-1.1 compiler which is built on top of the JDT-1.1 
compiler.  Any questions about JACK or suggested practical workaround should 
be handled by Feilong Chen.

BTW - The AspectJ team has been very impressed with the quality of your work.  
This is the first serious bug report we've had which turned out to be in the 
underlying JDT compiler we built on top of.
Comment 1 Philipe Mulet CLA 2003-06-03 05:17:30 EDT
This is a duplicate of a bug resolved since 2.1. 
The fix is integrated into our 2.1.1 delivery (we should be finalized soon).

*** This bug has been marked as a duplicate of 37621 ***