Bug 157379

Summary: [compiler] VerifyError when unused local is assigned and unused locals are optimized out
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: philippe_mulet
Version: 3.2   
Target Milestone: 3.2.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description Olivier Thomann CLA 2006-09-14 15:04:31 EDT
Using latest 3.2.1 maintenance build, the following code compiles fine, but runs with a Verify error:

public class X {
	public static boolean test() {
		boolean b = false;
		assert b = true;
		return false;
	}
	public static void main(String[] args) {
		test();
	}
}

I'll attach the patch that has been done in HEAD.
Comment 1 Olivier Thomann CLA 2006-09-14 15:05:50 EDT
Created attachment 50195 [details]
Proposed fix

This is the fix done in HEAD.
The problem comes from the fact that the assignment implicit conversion is not set. In fact we might want to verify if this is intended.
Comment 2 Philipe Mulet CLA 2006-09-15 03:49:08 EDT
The piece from HEAD comes from a larger change for addressing bug 155255.
In bug 155255 there is a 3.2maintenance patch, which I was reluctant to release since it was late in 3.2.1 game, and fairly risky.

It could be released for 3.2.2, once we are confident about its stability (based on 3.3 testing).
Comment 3 Philipe Mulet CLA 2007-01-09 05:12:53 EST
Added LocalVariableTest#test013 (both in 3.2.2 and 3.3).
WORKSFORME with fix for bug 155255 which got released for 3.2.2.

Comment 4 Philipe Mulet CLA 2007-01-09 05:17:43 EST
Actually the test is: LocalVariableTest#test015
Comment 5 Eric Jodet CLA 2007-01-16 05:17:52 EST
verified for 3.2.2 using build M20070112-1200