JDK-8357381 : C2: assert(false) failed: should not be here
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19,22
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2025-05-20
  • Updated: 2025-06-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26Unresolved
Related Reports
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
$ <JAVA_HOME>/bin/java -version
openjdk version "25-internal" 2025-09-16
OpenJDK Runtime Environment (fastdebug build 25-internal-adhoc.user.jdk-mainline)
OpenJDK 64-Bit Server VM (fastdebug build 25-internal-adhoc.user.jdk-mainline, mixed mode)

A DESCRIPTION OF THE PROBLEM :
When running the following code, the JDK crashes with the error message: assert(false) failed: should not be here. The code we provide is a minimized Java test case that reproduces the issue.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java && java Test

ACTUAL -
 1912 StrEquals === 1911 2275 1899 1902 714 [[ 2036 ]] !orig=[2034] !jvms: String::equals @ bci:44 (line 1921) Ce::cem @ bci:40 (line 20)
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (<JDK-REPO>/hotspot/jdk-24/src/hotspot/share/opto/escape.cpp:4083), pid=2202139, tid=2202163
# assert(false) failed: should not be here
#
# JRE version: OpenJDK Runtime Environment (25.0) (fastdebug build 25-internal-adhoc.qiusy.jdk-24)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 25-internal-adhoc.qiusy.jdk-24, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xd2382b] ConnectionGraph::move_inst_mem(Node*, GrowableArray<PhiNode*>&)+0x8eb
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to <FOLDER>/Test0789_05_15_11_23_30/reduce/core.2202139)
#
# An error report file with more information is saved as:
# <FOLDER>/Test0789_05_15_11_23_30/reduce/hs_err_pid2202139.log
#
# Compiler replay data is saved as:
# <FOLDER>/Test0789_05_15_11_23_30/reduce/replay_pid2202139.log
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
bash: line 1: 2202139 Aborted (core dumped) <JDK-REPO>/hotspot/jdk-24/build/linux-x86_64-server-fastdebug/jdk/bin/java -cp . Test


---------- BEGIN SOURCE ----------
class Test extends c159.HelperBase {
    public static void main(String[] strArr) {
        for (int var16 = 0; var16 < 100000; var16++) {
            Ce.VALUE2.cem("123456abc", "123456abc");
        }
    }
}

enum Ce {
    VALUE2;

    int cem(String id, String nameKey) {
        try {
            java.io.ByteArrayOutputStream stream = new java.io.ByteArrayOutputStream();
            java.math.BigInteger num = java.math.BigInteger.valueOf(123);
            int length = num.toByteArray().length;
            stream.write(num.toByteArray());
        } catch (Exception e) {
        }
        if ("UTC".equals(id) && id.equals(nameKey))
            ;
        return 0;
    }
}

class c159 {
    static class HelperBase {
    }
}

---------- END SOURCE ---------- 
Comments
The first round of EA does lock removal removing N1688. Since iterative EA was added in JDK-8276455, EA is run multiple times. After some ideal / identity transformations, MergeMem N1679 is replaced by StoreB N2194 as an input to StrEquals which is an unmatched case in ConnectionGraph::move_inst_mem caught during the second invocation of EA.
27-06-2025

I could reproduce since https://bugs.openjdk.java.net/browse/JDK-8276455 (removed the empty catch block).
17-06-2025

Traced back to JDK-8267532 - I'm not sure though if that just revealed an existing issue.
21-05-2025

ILW = Assertion failure in EA, single test, disable compilation of affected method or disable EA with -XX:-DoEscapeAnalysis = HLM = P3
20-05-2025