Bug 47776

Summary: java.lang.VerifyError / Illegal target of jump or branch compiling with 3.0 M5
Product: [Eclipse Project] JDT Reporter: St.efan <sjung>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: blocker    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Compiling and running this code on 3.0 M5 gives the error. none

Description St.efan CLA 2003-12-01 02:12:33 EST
Compiling and running attached code with 3.0 M5 gives a:

java.lang.VerifyError: (class: CompilerErrorTest, method: insertString 
signature: (ILjava/lang/String;Ljavax/print/attribute/AttributeSet;)V) Illegal 
target of jump or branch

Same code runs on 3.0 M4.
Same code runs compiled with sdk 1.4.2.
Comment 1 St.efan CLA 2003-12-01 02:17:06 EST
Created attachment 7013 [details]
Compiling and running this code on 3.0 M5 gives the error.
Comment 2 Philipe Mulet CLA 2003-12-01 06:50:31 EST
Reproduced
Comment 3 Philipe Mulet CLA 2003-12-01 07:34:30 EST
Simpler testcase:
public class X {
	public static void main(String[] args) {
		do {
			int i = 0;
			if (i > 0) break;
			System.out.println("SUCCESS");
			return;
		} while (true == false);
	}
}
Comment 4 Philipe Mulet CLA 2003-12-01 07:35:37 EST
public static void main(java.lang.String[]);
  Code:
   0:	iconst_0
   1:	istore_1
   2:	iload_1
   3:	ifle	9
   6:	goto	18
   9:	getstatic	#18; //Field .out:Ljava/io/PrintStream;
   12:	ldc	#20; //String SUCCESS
   14:	invokevirtual	#26; //Method PrintStream.println:(Ljava/lang/String;)V
   17:	return
   18:	return

Bytecode 18 is no longer generated
Comment 5 Philipe Mulet CLA 2003-12-01 10:13:51 EST
Problem is due to the new merge for flow info in DO statement. It is slightly 
different from the merge of a while statement, as breaks may occur before the 
condition is executed (path where we optimize false case).

Fixed by always turning off the #isOptimizedFalse flag to ensure we merge 
properly. This change isn't necessary for while/for loops as the condition is 
evaluated prior to any break (and thus break inits are already fake reachable 
on the optimized false case).

Added regression test: Conform#test238

Fixed
Comment 6 David Audel CLA 2003-12-17 07:40:46 EST
Verified for 3.0M6