# HG changeset patch # User Andreas Woess # Date 1421306683 -3600 # Node ID d493f179ef76c2ebce247f5a4b9709164c73f0ff # Parent c65f549c40155bca1c5320d56233cec141c4d92d BranchProbabilityNode: branch probability value may evaluate to NaN in unreached code diff -r c65f549c4015 -r d493f179ef76 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Thu Jan 15 06:34:53 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Thu Jan 15 08:24:43 2015 +0100 @@ -75,6 +75,12 @@ throw new GraalInternalError("A negative probability of " + probabilityValue + " is not allowed!"); } else if (probabilityValue > 1.0) { throw new GraalInternalError("A probability of more than 1.0 (" + probabilityValue + ") is not allowed!"); + } else if (Double.isNaN(probabilityValue)) { + /* + * We allow NaN if the node is in unreachable code that will eventually fall away, + * or else an error will be thrown during lowering since we keep the node around. + */ + return; } boolean couldSet = false; for (IntegerEqualsNode node : this.usages().filter(IntegerEqualsNode.class)) {