Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8322992

Javac fails with StackOverflowError when compiling deeply nested synchronized blocks

XMLWordPrintable

    • b20

        javac JavacBug.java

        The system is out of resources.
        Consult the following stack trace for details.
        java.lang.StackOverflowError
        at jdk.compiler/com.sun.tools.javac.jvm.Code.emitStackMapFrame(Code.java:1366)
        at jdk.compiler/com.sun.tools.javac.jvm.Code.emitStackMap(Code.java:1261)
        at jdk.compiler/com.sun.tools.javac.jvm.Code.emitop(Code.java:388)
        at jdk.compiler/com.sun.tools.javac.jvm.Code.emitop1w(Code.java:938)
        at jdk.compiler/com.sun.tools.javac.jvm.Items$LocalItem.store(Items.java:409)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genTry(Gen.java:1591)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSynchronized(Gen.java:1489)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSynchronized.accept(JCTree.java:1428)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:588)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:623)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:609)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:660)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.doVisitBlock(Gen.java:1102)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1095)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1092)

        I bisected this and it seems to be a regression in JDK 20 b27. Relevant changes to javac:
        https://bugs.openjdk.org/issues/?jql=project%20%3D%20JDK%20AND%20resolution%20%3D%20Fixed%20AND%20fixVersion%20%3D%20%2220%22%20AND%20component%20%3D%20tools%20AND%20%22Resolved%20In%20Build%22%20%3D%20b27%20AND%20Subcomponent%20%3D%20javac%20ORDER%20BY%20resolved%20DESC

              vromero Vicente Arturo Romero Zaldivar
              thartmann Tobias Hartmann
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: