Skip to content

Commit ddf326b

Browse files
committed
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
1 parent bac2aa4 commit ddf326b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/hotspot/share/opto/block.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,8 @@ void PhaseBlockLayout::find_edges() {
16131613
Block *target = b->non_connector_successor(j);
16141614
float freq = b->_freq * b->succ_prob(j);
16151615
int from_pct = (int) ((100 * freq) / b->_freq);
1616-
int to_pct = (int) ((100 * freq) / target->_freq);
1616+
float f_to_pct = (100 * freq) / target->_freq;
1617+
int to_pct = (f_to_pct < 100.0) ? (int)f_to_pct : 100;
16171618
edges->append(new CFGEdge(b, target, freq, from_pct, to_pct));
16181619
}
16191620
}

0 commit comments

Comments
 (0)