Skip to content

Commit

Permalink
Catch and ignore division by zero during cex reconstruction
Browse files Browse the repository at this point in the history
  • Loading branch information
agacek committed Sep 15, 2018
1 parent aee5e73 commit 8affd22
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions jkind/src/jkind/util/ModelReconstructionEvaluator.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,20 @@ private void reconstructValues(String property, int k) {
for (step = 0; step < k; step++) {
for (Dependency dependency : dependencies) {
if (dependency.type == DependencyType.VARIABLE) {
Value v1 = eval(new IdExpr(dependency.name));

// Compare computed value (v1) with solver value (v2)
if (!inlinedVariables.contains(dependency.name)) {
Value v2 = originalModel.getValue(new StreamIndex(dependency.name, step));
if (v2 != null && !v1.equals(v2)) {
throw new JKindException(
"Unable to reconstruct counterexample: variable value changed: " + dependency.name);
try {
Value v1 = eval(new IdExpr(dependency.name));

// Compare computed value (v1) with solver value (v2) when possible
if (!inlinedVariables.contains(dependency.name)) {
Value v2 = originalModel.getValue(new StreamIndex(dependency.name, step));
if (v2 != null && !v1.equals(v2)) {
throw new JKindException(
"Unable to reconstruct counterexample: variable value changed: "
+ dependency.name);
}
}
} catch (ArithmeticException ae) {
// Division by zero, ignore
}
}
}
Expand Down

0 comments on commit 8affd22

Please sign in to comment.