RFR: 8346888: [ubsan] block.cpp:1617:30: runtime error: 9.97582e+36 is outside the range of representable values of type 'int'

Dean Long dlong at openjdk.org
Sat Mar 15 01:05:59 UTC 2025


On Wed, 12 Mar 2025 20:38:25 GMT, Dean Long <dlong at openjdk.org> wrote:

>>> Do you think those high values are not expected ?
>> 
>> Sorry, my mistake. As @dean-long pointed out they are to be expected with very small values of `target->_freq`
>
> I think it would still be helpful to understand what kind of situations cause these extreme values.  I know there are places where we have to adjust for problematic 0 counts, so I'm wondering if something like that is happening here.

Yes, CFGLoop::scale_freq() is turning a 0 _freq value into MIN_BLOCK_FREQUENCY, which is 1.e-35f.  Dividing by such a small number can overflow a 32-bit int.  Maybe this is a never-taken out edge of an infinite loop?  It might be a bug to give this edge an effectively infinite frequency percentage.  This will cause CFGEdge::to_infrequent() to report false, when maybe it should return true.  I don't understand this code well enough to decide.  Maybe a loop expert can tell us if having this frequency overflow here is harmless or not.  Tagging @rwestrel and @TobiHartmann

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23962#discussion_r1996475459


More information about the hotspot-compiler-dev mailing list