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 04:01:58 UTC 2025


On Sat, 15 Mar 2025 01:03:39 GMT, Dean Long <dlong at openjdk.org> wrote:

>> 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

This code seems to be really old, from https://bugs.openjdk.org/browse/JDK-6743900.  Tagging reviewers @tkrodriguez and @vnkozlov .  To me, the formula for `to_pct` looks wrong.  I would expect `b->_freq` and `target->_freq `to be multiplied together, not divided.

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

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


More information about the hotspot-compiler-dev mailing list