RFR: 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' [v2]

Marc Chevalier mchevalier at openjdk.org
Tue Apr 29 16:37:02 UTC 2025


On Tue, 29 Apr 2025 16:26:16 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Marc Chevalier has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   +comment
>
> src/hotspot/share/ci/ciMethod.cpp line 919:
> 
>> 917:       double count_d = (double)count * prof_factor * method_life / counter_life + 0.5;
>> 918:       if (count_d >= static_cast<double>(INT_MAX)) {
>> 919:         count = INT_MAX;
> 
> Suggestion:
> 
>         // Clamp in case of overflowing int range.
>         count = INT_MAX;

Yes, good. Done.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24824#discussion_r2066936765


More information about the hotspot-compiler-dev mailing list