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

Reviewed-by: kvn, dlong
This commit is contained in:
Matthias Baesken
2025-03-28 08:19:20 +00:00
parent bac2aa4445
commit ddf326b8e6

View File

@@ -1613,7 +1613,8 @@ void PhaseBlockLayout::find_edges() {
Block *target = b->non_connector_successor(j);
float freq = b->_freq * b->succ_prob(j);
int from_pct = (int) ((100 * freq) / b->_freq);
int to_pct = (int) ((100 * freq) / target->_freq);
float f_to_pct = (100 * freq) / target->_freq;
int to_pct = (f_to_pct < 100.0) ? (int)f_to_pct : 100;
edges->append(new CFGEdge(b, target, freq, from_pct, to_pct));
}
}