Community
Participate
Working Groups
Using v_755, I got the following test case: public class X { boolean b; X(boolean b1) { if ((b1 == (b = b1)) || (false && b1)) { System.out.println(b); } } } That leads to dead bytecodes: // Method descriptor #8 (Z)V // Stack: 4, Locals: 2 X(boolean b1); 0 aload_0 [this] 1 invokespecial Object() [10] 4 iload_1 [b1] 5 aload_0 [this] 6 iload_1 [b1] 7 dup_x1 8 putfield X.b : boolean [13] 11 if_icmpeq 20 14 goto 30 17 goto 30 20 getstatic System.out : PrintStream [15] 23 aload_0 [this] 24 getfield X.b : boolean [13] 27 invokevirtual PrintStream.println(boolean) : void [21] 30 return The bytecode at pc 14 is dead.
variation: if (b1 || !(true || b1)) { System.out.println(b1); }
Created attachment 66071 [details] Proposed patch
Added BooleanTest#test044-049. Oliver - pls review
+1
Released for 3.3RC1. Fixed
Verified for 3.3 RC1 using I20070515-0010