JDK-8333098 : ubsan: bytecodeInfo.cpp:318:59: runtime error: division by zero
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18,21,23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2024-05-28
  • Updated: 2024-09-05
  • Resolved: 2024-08-29
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 24
24 b14Fixed
Related Reports
Relates :  
Relates :  
Description
When running test
compiler/classUnloading/methodUnloading/TestOverloadCompileQueues.java
with ubsan enabled binaries we run into the issue reported below.
Reason seems to be that we divide by zero in the code (maybe we should instead check for CompilationPolicy::min_invocations() == 0 in in this case set min_freq to MinInlineFrequencyRatio) .
      double min_freq = MAX2(MinInlineFrequencyRatio, 1.0 / CompilationPolicy::min_invocations());

/jdk/src/hotspot/share/opto/bytecodeInfo.cpp:318:59: runtime error: division by zero
    #0 0x7f5145c0dda2 in InlineTree::should_not_inline(ciMethod*, ciMethod*, int, bool&, ciCallProfile&) src/hotspot/share/opto/bytecodeInfo.cpp:318
    #1 0x7f51466366d7 in InlineTree::try_to_inline(ciMethod*, ciMethod*, int, JVMState*, ciCallProfile&, bool&) src/hotspot/share/opto/bytecodeInfo.cpp:382
    #2 0x7f514663d36b in InlineTree::ok_to_inline(ciMethod*, JVMState*, ciCallProfile&, bool&) src/hotspot/share/opto/bytecodeInfo.cpp:596
    #3 0x7f51470dffd6 in Compile::call_generator(ciMethod*, int, bool, JVMState*, bool, float, ciKlass*, bool) src/hotspot/share/opto/doCall.cpp:189
    #4 0x7f51470e18ab in Parse::do_call() src/hotspot/share/opto/doCall.cpp:641
    #5 0x7f514887dbf1 in Parse::do_one_block() src/hotspot/share/opto/parse1.cpp:1607
    #6 0x7f514887fefa in Parse::do_all_blocks() src/hotspot/share/opto/parse1.cpp:724
    #7 0x7f514888d4da in Parse::Parse(JVMState*, ciMethod*, float) src/hotspot/share/opto/parse1.cpp:628
    #8 0x7f51469d8418 in ParseGenerator::generate(JVMState*) src/hotspot/share/opto/callGenerator.cpp:99
    #9 0x7f5146d99cff in Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*) src/hotspot/share/opto/compile.cpp:793
    #10 0x7f51469d5ebf in C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*) src/hotspot/share/opto/c2compiler.cpp:142
    #11 0x7f5146db0274 in CompileBroker::invoke_compiler_on_method(CompileTask*) src/hotspot/share/compiler/compileBroker.cpp:2303
    #12 0x7f5146db2826 in CompileBroker::compiler_thread_loop() src/hotspot/share/compiler/compileBroker.cpp:1961
    #13 0x7f51478d475a in JavaThread::thread_main_inner() src/hotspot/share/runtime/javaThread.cpp:759
    #14 0x7f51491620ea in Thread::call_run() src/hotspot/share/runtime/thread.cpp:225
    #15 0x7f51487ac201 in thread_native_entry src/hotspot/os/linux/os_linux.cpp:846
    #16 0x7f514e5cf6e9 in start_thread (/lib64/libpthread.so.0+0xa6e9) (BuildId: 2f8d3c2d0f4d7888c2598d2ff6356537f5708a73)
    #17 0x7f514db1550e in clone (/lib64/libc.so.6+0x11850e) (BuildId: f732026552f6adff988b338e92d466bc81a01c37)
Comments
Changeset: f080b4bb Branch: master Author: Matthias Baesken <mbaesken@openjdk.org> Date: 2024-08-29 07:07:12 +0000 URL: https://git.openjdk.org/jdk/commit/f080b4bb8a75284db1b6037f8c00ef3b1ef1add1
29-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20615 Date: 2024-08-16 11:57:09 +0000
16-08-2024

ILW = Undefined behavior due to division by zero (harmless because it only affects inlining decision), with ubsan and single test setting Tier4MinInvocationThreshold to zero via threshold scaling, set Tier4MinInvocationThreshold explicitly via the command line = MLM = P4
30-05-2024

Code is from JDK-8273712.
30-05-2024