Bug 47881

Summary: [Compiler] x && false evaluates to "true"
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 2.1.3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Philipe Mulet CLA 2003-12-02 09:09:29 EST
Build 3.0M5+ JDTCore HEAD from 20031202

When running the following program, it will print FAILED, though it should have 
succeeded.

public class X  {

    public static void main(String args[]) {
		boolean b = true;
		b = b && false;                 
		if (b) {
			System.out.println("FAILED");
		} else {
			System.out.println("SUCCESS");
		}
    }
}

Problem is due to compiler misoptimizing expression 'b && false'
Comment 1 Philipe Mulet CLA 2003-12-02 09:10:34 EST
This is a regression introduced with fix for bug 46675.
Addressed in latest.
Comment 2 Philipe Mulet CLA 2003-12-02 09:11:48 EST
Copy-paste bug, the optimized scenario 'x && false' did generate iconst1 
instead of iconst0.

Fixed
Comment 3 Philipe Mulet CLA 2003-12-02 10:23:27 EST
Backported to 2.1 stream (also backported regression tests onto ConformTest#238-
242).
Comment 4 David Audel CLA 2003-12-17 11:00:19 EST
Verified for 3.0M6
Comment 5 Frederic Fusier CLA 2004-03-01 12:38:53 EST
Verified for 2.1.3 with build M200402251535.