| Summary: | VerifyError "Inconsistent stackmap frames" for switch-string statement with nested for-loop | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Andre Bargull <andrebargull+eclipse> | ||||||
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | major | ||||||||
| Priority: | P3 | CC: | amj87.iitr, daniel_megert, jarthana, Olivier_Thomann | ||||||
| Version: | 3.8 | Flags: | daniel_megert:
pmc_approved+
jarthana: review+ |
||||||
| Target Milestone: | 3.6.2+J7 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Simplified test case:
---
public static void normalize0() {
switch ("") {
default:
{
int j = 0;
if (j < 0) ;
}
return;
}
}
---
Reproduced with latest in 3.7.maintenance. I am investigating. This might be a candidate for 3.7.1 as it is a verify error. Verify errors are severe issues. Created attachment 202328 [details]
Proposed fix + regression tests
Two things:
1) The secret local must be created before the switch's statements are resolved. If one of them is a block that defines more locals, the locals overlap and it returns a VerifyError.
2) When there is no cases statements, the value generated by the invoke hashcode call must be popped from the stack. Otherwise we "keep" a value on the stack after the switch statement is done. This tends to generate bigger stack map frames.
Daniel, pmc approval is required for 3.7.1 release. Jay, please review asap. Thanks. +1. This needs to be fixed for 3.7.1. Patch looks good to me Created attachment 202347 [details]
Proposed fix + regression tests (3.7.x)
Same patch for 3.7.1 where the error message is slightly different from 3.8.
This affects the tests only. Not the code itself. Released for 3.7.1RC3 and 3.8M2. Verified for 3.7.1 with build M20110831-1030. Verified for 3.8M2 using build I20110911-2000. For the record, this fix was also released in R3_6_maintenance_Java7 via commit 85bffda76894743d59fada2a6e096ed63bf7a359 |
Build Identifier: M20110825-0847 Executing the following test case will result in a VerifyError "Inconsistent stackmap frames at branch target". Environment: - Eclipse 3.7.1 (M20110825-0847) - JDK7 Stacktrace: --- Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames at branch target 42 in method example.Testcase.normalize()V at offset 39 at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2442) at java.lang.Class.getMethod0(Class.java:2685) at java.lang.Class.getMethod(Class.java:1620) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:484) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:476) --- --- public class Testcase { public static void main(String args[]) { } public static void normalize() { int k; switch ("") { case "": for (int j = 0; j < 0;) { break; } k = 0; } } } --- Reproducible: Always