JDK-8352422 : [ubsan] Out-of-range reported in ciMethod.cpp:917:20: runtime error: 2.68435e+09 is outside the range of representable values of type 'int'
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x,aix
  • Submitted: 2025-03-19
  • Updated: 2025-05-08
  • Resolved: 2025-04-30
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 25
25 b21Fixed
Related Reports
Relates :  
Description
When running on macOS aarch64 (XCode15) with ubsan-enabled binaries, the test 
compiler/profiling/TestProfileCounterOverflow.java
generates this error :

/priv/jenkins/client-home/workspace/openjdk-jdk-weekly-macos_aarch64-opt/jdk/src/hotspot/share/ci/ciMethod.cpp:917:20: runtime error: 2.68435e+09 is outside the range of representable values of type 'int'
    #0 0x106fb10ac in ciMethod::scale_count(int, float) ciMethod.cpp:917
    #1 0x1073e77e0 in Compile::call_generator(ciMethod*, int, bool, JVMState*, bool, float, ciKlass*, bool) doCall.cpp:187
    #2 0x1073ea468 in Parse::do_call() doCall.cpp:645
    #3 0x107c6e100 in Parse::do_one_block() parse1.cpp:1586
    #4 0x107c6c414 in Parse::do_all_blocks() parse1.cpp:724
    #5 0x107c69d98 in Parse::Parse(JVMState*, ciMethod*, float) parse1.cpp:628
    #6 0x107c6d6f4 in Parse::Parse(JVMState*, ciMethod*, float) parse1.cpp:404
    #7 0x106f347d0 in ParseGenerator::generate(JVMState*) callGenerator.cpp:97
    #8 0x1070a50f8 in Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*) compile.cpp:803
    #9 0x1070a8554 in Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*) compile.cpp:693
    #10 0x106f32334 in C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*) c2compiler.cpp:141
    #11 0x1070cb888 in CompileBroker::invoke_compiler_on_method(CompileTask*) compileBroker.cpp:2331
    #12 0x1070cae70 in CompileBroker::compiler_thread_loop() compileBroker.cpp:1975
    #13 0x1076cc254 in JavaThread::thread_main_inner() javaThread.cpp:776
    #14 0x107f08d68 in Thread::call_run() thread.cpp:231
    #15 0x107c2dc44 in thread_native_entry(Thread*) os_bsd.cpp:601
    #16 0x1936fef90 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x6f90)
    #17 0x1936f9d30 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d30)


The out of range happens here :

909  int ciMethod::scale_count(int count, float prof_factor) {
......
916      if (counter_life > 0) {
917        count = (int)((double)count * prof_factor * method_life / counter_life + 0.5);

Comments
Changeset: d802fd0d Branch: master Author: Marc Chevalier <mchevalier@openjdk.org> Committer: Emanuel Peter <epeter@openjdk.org> Date: 2025-04-30 08:45:54 +0000 URL: https://git.openjdk.org/jdk/commit/d802fd0da234275c79b67f74f2cfb15fbe18d7b9
30-04-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24824 Date: 2025-04-23 10:58:54 +0000
23-04-2025

Same can be seen on AIX when running with ubsan - enabled binaries : compiler/profiling/TestProfileCounterOverflow.java : /srcdir/jdk/src/hotspot/share/ci/ciMethod.cpp:917:20: runtime error: 2.68435e+09 is outside the range of representable values of type 'int'
11-04-2025

ILW = Possibly setting wrong scale count due to cast overflow from double to int (might lead to inefficient code), low?, no workaround but disable compilation of affected method = MLM = P4
20-03-2025