Bug 41604 - Possible Compiler Bug ?
Summary: Possible Compiler Bug ?
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 blocker (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-15 08:50 EDT by Stefan Guenst (ose) CLA
Modified: 2003-10-14 11:08 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Guenst (ose) CLA 2003-08-15 08:50:05 EDT
java.lang.VerifyError: (class: Tester, method: main signature:
([Ljava/lang/String;)V) Unable to pop operand off an empty stack

Exception in thread "main" 

jdk is 1.4.2

--------------------------- snip -------------------------------

public class Tester {

        public static void main(String[] args) {
                Test2 t2 = new Test2();
                t2.test = new Test();
                t2.test.str = ""+t2.test.num;
        }
}

class Test {
        public String str;
        public int num;
}

class Test2 {
        public static Test test = null;
}
Comment 1 Adam Kiezun CLA 2003-08-15 10:27:04 EDT
jdt, not platform
Comment 2 Olivier Thomann CLA 2003-08-18 11:51:43 EDT
The problem comes from the code generation of the t2.test.str qualified name
reference.
We generate a getClass() as a null check because test is a static field. The
problem is that t2 is not on the stack so getClass() is invoked with an empty stack.
Comment 3 Philipe Mulet CLA 2003-08-26 08:41:47 EDT
I have a fix for this.
Comment 4 Philipe Mulet CLA 2003-08-28 12:18:13 EDT
Fixed, regression test added. In this scenario, the lastFieldBinding was not 
correctly positionned when first binding is local variable.

			case LOCAL : // reading the first local variable
>>>>				lastFieldBinding = null;
				if (!needValue) break; // no value needed
Comment 5 David Audel CLA 2003-10-14 11:08:40 EDT
Verified.