JDK-8073300 : Unexpected CompileError due to liveness analysis for debug symbols
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8u31
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2015-02-09
  • Updated: 2015-10-29
  • Resolved: 2015-10-29
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
# java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

# javac -version
javac 1.8.0_31


ADDITIONAL OS VERSION INFORMATION :
Linux sit1v085-2 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
Class does not compile

REGRESSION.  Last worked in version 7u76

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile with:
javac -g:vars <className>

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
class to compile
ACTUAL -
does not compile on JDK 8. Tested on u25 and u31.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.8.0_31). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.AssertionError
	at com.sun.tools.javac.util.Assert.error(Assert.java:126)
	at com.sun.tools.javac.util.Assert.check(Assert.java:45)
	at com.sun.tools.javac.jvm.ClassWriter.writeCode(ClassWriter.java:1189)
	at com.sun.tools.javac.jvm.ClassWriter.writeMethod(ClassWriter.java:1110)
	at com.sun.tools.javac.jvm.ClassWriter.writeMethods(ClassWriter.java:1602)
	at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1692)
	at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1620)
	at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:746)
	at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1572)
	at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1536)
	at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
	at com.sun.tools.javac.main.Main.compile(Main.java:523)
	at com.sun.tools.javac.main.Main.compile(Main.java:381)
	at com.sun.tools.javac.main.Main.compile(Main.java:370)
	at com.sun.tools.javac.main.Main.compile(Main.java:361)
	at com.sun.tools.javac.Main.compile(Main.java:56)
	at com.sun.tools.javac.Main.main(Main.java:42)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class FooBar {

    // run: javac -g:vars FooBar.java
    public static void COMPILER_GOES_BOOM() {
        { // need to have a block here.
            //int before = 0; // assigning values here and it compiles fine,
            int i;
            int j;
            if (Boolean.valueOf("true")) {
                i = 1;
                System.out.println(i);
            }
            if (Boolean.valueOf("true")) {
                j = 2;
                System.out.println(j);
            }
            // int after; // comment in and it compiles fine.
        }
    }

}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
change the code so the variable scope changes


Comments
Escape-exclude label is defined, since duplicate JDK-8058708 is already taken into account for Bug escape analysis.
06-04-2015

Yes, could verify that this is not reproducible with JDK 9 ea b50 as well JDK 8u40 b23. Closing this as a duplicate of JDK-8058708 which has fix marked with JDK 8u40 b10 and JDK 9 b33.
18-02-2015

The test case compiles fine with, JDK 7u76, 8, 8u11, and 8u40ea b23 However, it failed with java.lang.AssertionError for, JDK 8u20, 8u25, 8u31, 9ea b50
17-02-2015