Bug 304416 - VerifyError after compiling without preserve all locals
Summary: VerifyError after compiling without preserve all locals
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-02 15:26 EST by Andrew Niefer CLA
Modified: 2010-03-09 12:05 EST (History)
0 users

See Also:


Attachments
patch to reproduce (75.69 KB, patch)
2010-03-02 15:26 EST, Andrew Niefer CLA
no flags Details | Diff
Proposed fix (1.97 KB, patch)
2010-03-02 15:44 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Niefer CLA 2010-03-02 15:26:16 EST
Created attachment 160679 [details]
patch to reproduce

Running I20100302-0800 on linux.gtk.x86

If "Preserve unused (never read) local variables" is not checked (this is what happens during export or a releng build), then running the bundle org.eclipse.equinox.frameworkadmin.equinox gives:

java.lang.VerifyError: (org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser) local variable index out of range in load in method 8 (readFwConfig(Lorg/eclipse/equinox/internal/provisional/frameworkadmin/Manipulator;Ljava/io/File;)V) at pc=285

For the source, get (/cvsroot/rt/org.eclipse.equinox/p2/bundles/)
org.eclipse.equinox.frameworkadmin
org.eclipse.equinox.frameworkadmin.equinox
from head and apply the attached patch.
Comment 1 Olivier Thomann CLA 2010-03-02 15:43:51 EST
This is bad. I believe this is due to the usage of FAKE_USED for one of the locals.
The small test case reproduces the issue:

public class X {
  public static void main(String[] args) {
  	String s = null;
  	String s2 = null;
  	if (s != null && s2 != null) {
  		System.out.println(s);
  		System.out.println(s2);
  	}
  }
}

In the test (s != null && s2 != null), s2 is tagged as FAKE_USED and therefore doesn't get a resolved position. When we end up generating the code for it, we generate aload 255 since its resolved position is set to -1.
Comment 2 Olivier Thomann CLA 2010-03-02 15:44:19 EST
Created attachment 160683 [details]
Proposed fix

Patch under testing.
Comment 3 Olivier Thomann CLA 2010-03-03 13:24:33 EST
Released for 3.6M6.
Added regression tests:
org.eclipse.jdt.core.tests.compiler.regression.NullReferenceTest#testBug304416
Comment 4 Frederic Fusier CLA 2010-03-09 12:05:28 EST
Verified for 3.6M6 using I20100307-2000 build.