C2 SuperWord: assert(has_ctrl(i)) failed: should be control, not loop

XMLWordPrintable

    • b21

      Found by Fuzzer.

      Note: the fuzzer had found it with a different seed on a linux-aarch64 machine. I could not reproduce it with that seed, but randomizing the seed a few times found me one that did reproduce on my avx512 laptop.

      Hitting an assert in debug, bug SIGSEGV in product.

      java -Xmx1G -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::* -XX:-TieredCompilation -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:StressSeed=94737571 -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN -XX:+StressCCP -XX:+StressMacroExpansion -XX:+StressLoopPeeling Test_3580.java

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/empeter/Documents/oracle/jdk-fork4/open/src/hotspot/share/opto/loopnode.hpp:1101), pid=2540181, tid=2540196
      # assert(has_ctrl(i)) failed: should be control, not loop
      #
      # JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-internal-2025-10-13-1502242.empeter...)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-internal-2025-10-13-1502242.empeter..., mixed mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x154379c] PhaseIdealLoop::get_ctrl(Node const*)+0x21c
      [empeter@emanuel bin]$ head -n 100 hs_err_pid2540181.log
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/empeter/Documents/oracle/jdk-fork4/open/src/hotspot/share/opto/loopnode.hpp:1101), pid=2540181, tid=2540196
      # assert(has_ctrl(i)) failed: should be control, not loop
      #
      # JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-internal-2025-10-13-1502242.empeter...)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-internal-2025-10-13-1502242.empeter..., mixed mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x154379c] PhaseIdealLoop::get_ctrl(Node const*)+0x21c
      #
      # Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %d" (or dumping to /home/empeter/Documents/oracle/jdk-fork4/build/linux-x64-debug/jdk/bin/core.2540181)
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      #

      --------------- S U M M A R Y ------------

      Command Line: -Xmx1G -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::* -XX:-TieredCompilation -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:StressSeed=94737571 -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN -XX:+StressCCP -XX:+StressMacroExpansion -XX:+StressLoopPeeling --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.SourceLauncher Test_3580.java

      Host: ???, 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz, 16 cores, 29G, Oracle Linux Server release 9.6
      Time: Wed Oct 15 12:51:56 2025 CEST elapsed time: 7.364189 seconds (0d 0h 0m 7s)

      --------------- T H R E A D ---------------

      Current thread (0x00007fa3441d1760): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=2540196, stack(0x00007fa332ff1000,0x00007fa3330f1000) (1024K)]


      Current CompileTask:
      C2:7364 129 !b Test_3580::vMeth (514 bytes)

      Stack: [0x00007fa332ff1000,0x00007fa3330f1000], sp=0x00007fa3330eb440, free space=1001k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x154379c] PhaseIdealLoop::get_ctrl(Node const*)+0x21c (loopnode.hpp:1101)
      V [libjvm.so+0x1ad5095] VLoop::in_bb(Node const*) const+0x45 (vectorization.hpp:220)
      V [libjvm.so+0x1acdc13] VLoopBody::construct()+0x9a3 (superword.cpp:2402)
      V [libjvm.so+0x1c0b338] VLoopAnalyzer::setup_submodules_helper()+0x48 (vectorization.cpp:185)
      V [libjvm.so+0x1c0b3f4] VLoopAnalyzer::setup_submodules()+0x44 (vectorization.cpp:163)
      V [libjvm.so+0x15b59c1] PhaseIdealLoop::auto_vectorize(IdealLoopTree*, VSharedData&)+0x991 (vectorization.hpp:794)
      V [libjvm.so+0x15938ad] PhaseIdealLoop::build_and_optimize()+0xfdd (loopnode.cpp:5276)
      V [libjvm.so+0xb8c370] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x4c0 (loopnode.hpp:1189)
      V [libjvm.so+0xb832a4] Compile::optimize_loops(PhaseIterGVN&, LoopOptsMode)+0xb4 (compile.cpp:2262)
      V [libjvm.so+0xb861f1] Compile::Optimize()+0xcc1 (compile.cpp:2511)
      V [libjvm.so+0xb893a3] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x2023 (compile.cpp:860)
      V [libjvm.so+0x9a2ff3] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x4a3 (c2compiler.cpp:147)
      V [libjvm.so+0xb988b0] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x780 (compileBroker.cpp:2345)
      V [libjvm.so+0xb9a110] CompileBroker::compiler_thread_loop()+0x530 (compileBroker.cpp:1989)
      V [libjvm.so+0x10f11bb] JavaThread::thread_main_inner()+0x13b (javaThread.cpp:772)
      V [libjvm.so+0x1b63166] Thread::call_run()+0xb6 (thread.cpp:243)
      V [libjvm.so+0x17d0648] thread_native_entry(Thread*)+0x128 (os_linux.cpp:883)

        1. Test_3580.java
          11 kB
        2. replay_pid2540181.log
          281 kB
        3. hs_err_pid2540181.log
          84 kB
        4. FuzzerUtils.java
          13 kB

            Assignee:
            Emanuel Peter
            Reporter:
            Emanuel Peter
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: