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

C2 compilation fails with "all memory state should have been processed" assert

XMLWordPrintable

    • b19
    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      $ cat /etc/os-release
      PRETTY_NAME="Ubuntu 22.04.4 LTS"
      NAME="Ubuntu"
      VERSION_ID="22.04"
      VERSION="22.04.4 LTS (Jammy Jellyfish)"
      VERSION_CODENAME=jammy
      ID=ubuntu
      ID_LIKE=debian
      HOME_URL="https://www.ubuntu.com/"
      SUPPORT_URL="https://help.ubuntu.com/"
      BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
      PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
      UBUNTU_CODENAME=jammy

      $ java -version
      openjdk version "23-internal" 2024-09-17
      OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.jdk23u)
      OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.jdk23u, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      When we run the following test case using jdk23u (latest code from GitHub), the JVM crashes. We also tested other JDKs and found that jdk17u has the same issue, while jdk21-release does not have this problem, nor does jdk8u. Additionally, running jdk23u with the -Xint parameter does not cause any issues.

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

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      run without exception
      ACTUAL -
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/data/jdk23u/src/hotspot/share/opto/loopnode.cpp:711), pid=2117538, tid=2118042
      # assert(mm == nullptr|| _igvn.transform(mm) == mem->as_MergeMem()->base_memory()) failed: all memory state should have been processed
      #
      # JRE version: OpenJDK Runtime Environment (23.0) (fastdebug build 23-internal-adhoc.jdk23u)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 23-internal-adhoc.jdk23u, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x12ad786] PhaseIdealLoop::find_safepoint(Node*, Node*, IdealLoopTree*)+0xe26
      #
      # 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 /data/toreport/Test2200_07_05_10_00_52/reduce/core.2117538)
      #
      # An error report file with more information is saved as:
      # /data/toreport/Test2200_07_05_10_00_52/reduce/hs_err_pid2117538.log
      #
      # Compiler replay data is saved as:
      # /data/toreport/Test2200_07_05_10_00_52/reduce/replay_pid2117538.log
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      #

      Current CompileTask:
      C2:1864 1462 % ! 4 Test::c @ 36 (94 bytes)

      Stack: [0x00007f0f0b265000,0x00007f0f0b366000], sp=0x00007f0f0b360ac0, free space=1006k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x12791cf] PhaseIdealLoop::find_safepoint(Node*, Node*, IdealLoopTree*)+0xb1f (loopnode.cpp:711)
      V [libjvm.so+0x1297832] PhaseIdealLoop::is_counted_loop(Node*, IdealLoopTree*&, BasicType)+0x2492
      V [libjvm.so+0x129818f] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0x6f
      V [libjvm.so+0x12981d2] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0xb2
      V [libjvm.so+0x12981d2] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0xb2
      V [libjvm.so+0x129ce47] PhaseIdealLoop::build_and_optimize()+0x837
      V [libjvm.so+0x9e8ee0] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x390
      V [libjvm.so+0x9e1bc5] Compile::optimize_loops(PhaseIterGVN&, LoopOptsMode)+0x75
      V [libjvm.so+0x9e4351] Compile::Optimize()+0xe21
      V [libjvm.so+0x9e7a96] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b06
      V [libjvm.so+0x8357a5] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1d5
      V [libjvm.so+0x9f36d8] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x928
      V [libjvm.so+0x9f4368] CompileBroker::compiler_thread_loop()+0x478
      V [libjvm.so+0xe9cd6c] JavaThread::thread_main_inner()+0xcc
      V [libjvm.so+0x17bd816] Thread::call_run()+0xb6
      V [libjvm.so+0x14a5607] thread_native_entry(Thread*)+0x127

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

        void c() {
          int e;
          float f;
          for (long d = 0; d < 5000; d++) {
            e = 1;
            while ((e += 3) < 200)
              if (d < b.length)
                for (int g = 0; g < 10000; ++g) ;
            synchronized (Test.class) {
              f = new h(e).n;
            }
          }
        }

        public static void main(String[] m) {
          Test o = new Test();
          o.c();
        }
      }

      class h {
        float n;
        h(float n) { this.n = n; }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            roland Roland Westrelin
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: