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

C2: assert(idx == alias_idx) failed: Following Phi nodes should be on the same memory slice

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      The attached Test.java fails reliably with the following assertion:

      $ java Test.java

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/opt/mach5/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S159505/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/8cd8975f-aae7-42a6-825d-91ff5feb2ef0/runs/fd2688ee-df87-438e-994d-bdd923c21d85/workspace/open/src/hotspot/share/opto/escape.cpp:4080), pid=167688, tid=167707
      # assert(idx == alias_idx) failed: Following Phi nodes should be on the same memory slice
      #
      # JRE version: Java(TM) SE Runtime Environment (25.0+21) (fastdebug build 25-ea+21-LTS-2453)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-ea+21-LTS-2453, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xd11cc3] ConnectionGraph::move_inst_mem(Node*, GrowableArray<PhiNode*>&)+0x683
      ...............
      C2:1425 30 b Test::test (33 bytes)

      Stack: [0x00007cbea2300000,0x00007cbea2400000], sp=0x00007cbea23fa710, free space=1001k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0xda156c] ConnectionGraph::move_inst_mem(Node*, GrowableArray<PhiNode*>&)+0x8e8 (escape.cpp:4080)
      V [libjvm.so+0xda5ff8] ConnectionGraph::split_unique_types(GrowableArray<Node*>&, GrowableArray<ArrayCopyNode*>&, GrowableArray<MergeMemNode*>&, Unique_Node_List&)+0x3b8c (escape.cpp:4935)
      V [libjvm.so+0xd8f7f5] ConnectionGraph::compute_escape()+0x1719 (escape.cpp:396)
      V [libjvm.so+0xd8e03c] ConnectionGraph::do_analysis(Compile*, PhaseIterGVN*)+0x1ac (escape.cpp:118)
      V [libjvm.so+0xb0e64d] Compile::Optimize()+0xb1f (compile.cpp:2396)
      V [libjvm.so+0xb06270] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1940 (compile.cpp:860)
      V [libjvm.so+0x9b9a14] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x486 (c2compiler.cpp:141)
      V [libjvm.so+0xb2e535] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xe01 (compileBroker.cpp:2307)
      V [libjvm.so+0xb2c92e] CompileBroker::compiler_thread_loop()+0x576 (compileBroker.cpp:1951)
      V [libjvm.so+0xb4ec23] CompilerThread::thread_entry(JavaThread*, JavaThread*)+0x89 (compilerThread.cpp:67)
      V [libjvm.so+0x101bdbc] JavaThread::thread_main_inner()+0x1b2 (javaThread.cpp:773)
      V [libjvm.so+0x101bc07] JavaThread::run()+0x1d7 (javaThread.cpp:758)
      V [libjvm.so+0x18c96fd] Thread::call_run()+0x1b9 (thread.cpp:231)
      V [libjvm.so+0x15ed8ff] thread_native_entry(Thread*)+0x1f5 (os_linux.cpp:870)


      ======= Original report =======
      ADDITIONAL SYSTEM INFORMATION :
      java -version
      openjdk version "25-internal" 2025-09-16
      OpenJDK Runtime Environment (fastdebug build 25-internal-adhoc.user.jdk)
      OpenJDK 64-Bit Server VM (fastdebug build 25-internal-adhoc.user.jdk, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      When I used the JVM compiled from the OpenJDK source code obtained from GitHub to run the following code, the JVM crashed. After enabling the -Xint option to disable JIT, the issue no longer occurred. Based on the location of the assert, we suspect that there is a bug in the C2 compiler of the JIT.

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

      ACTUAL -
      A crash may occur during runtime (about once in every three runs).

      ---------- BEGIN SOURCE ----------
      class Test {
          static int[] iArrFld = new int[400];

          static int method9() {
              int[] more = { 94 };
              java.util.function.Predicate<Integer> check = m -> m == 0;
              java.util.function.IntConsumer decrement = x -> more[0]--;
              java.util.function.BooleanSupplier innerLoop = () -> {
                  while (!check.test(more[0]))
                      decrement.accept(0);
                  return true;
              };
              innerLoop.getAsBoolean();
              java.util.function.BooleanSupplier process = () -> check.test(more[0]);
              while (!process.getAsBoolean()) {
              }
              return 0;
          }

          public static void main(String[] strArr) {
              int i14 = 1;
              do {
                  iArrFld[i14] = 211;
                  for (int i15 = 1; i15 < 4; ++i15)
                      i14 = Test.method9();
              } while (i14 < 5);
          }
      }

      ---------- END SOURCE ----------

        1. hs_err_pid3381922.log
          87 kB
        2. replay_pid3381922.log
          174 kB
        3. Test.java
          2 kB

            kvn Vladimir Kozlov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: