Community
Participate
Working Groups
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.
Created attachment 7013 [details] Compiling and running this code on 3.0 M5 gives the error.
Reproduced
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); } }
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
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
Verified for 3.0M6