Bug 185567 - [compiler] dead bytecodes are generated inside optimized boolean condition
Summary: [compiler] dead bytecodes are generated inside optimized boolean condition
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 RC1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-04 11:23 EDT by Olivier Thomann CLA
Modified: 2007-05-15 05:43 EDT (History)
0 users

See Also:
Olivier_Thomann: review+


Attachments
Proposed patch (6.14 KB, patch)
2007-05-07 06:27 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2007-05-04 11:23:59 EDT
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.
Comment 1 Philipe Mulet CLA 2007-05-04 13:02:00 EDT
variation:
		if (b1 || !(true || b1)) {
			System.out.println(b1);
		}
Comment 2 Philipe Mulet CLA 2007-05-07 06:27:07 EDT
Created attachment 66071 [details]
Proposed patch
Comment 3 Philipe Mulet CLA 2007-05-07 06:29:08 EDT
Added BooleanTest#test044-049.
Oliver - pls review
Comment 4 Olivier Thomann CLA 2007-05-07 10:03:57 EDT
+1
Comment 5 Philipe Mulet CLA 2007-05-07 10:25:30 EDT
Released for 3.3RC1.
Fixed
Comment 6 Eric Jodet CLA 2007-05-15 05:37:42 EDT
Verified for 3.3 RC1 using I20070515-0010