Bug 47881 - [Compiler] x && false evaluates to "true"
Summary: [Compiler] x && false evaluates to "true"
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1.3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-02 09:09 EST by Philipe Mulet CLA
Modified: 2004-03-01 12:38 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.