summaryrefslogtreecommitdiff
path: root/Source/VCGeneration
diff options
context:
space:
mode:
authorGravatar Ally Donaldson <unknown>2013-07-22 09:49:33 +0100
committerGravatar Ally Donaldson <unknown>2013-07-22 09:49:33 +0100
commit0eb1f021dd9f0a24c03f8d9b5124f49840ee6f1d (patch)
tree51ba8345a9384e9c570d664aa6cf4a307238a518 /Source/VCGeneration
parent3b15454ac18f93e8f42913af80f665a900fd4378 (diff)
Fixed bugs arising from differences between hashtables and dictionaries
Diffstat (limited to 'Source/VCGeneration')
-rw-r--r--Source/VCGeneration/ConditionGeneration.cs7
-rw-r--r--Source/VCGeneration/VC.cs2
2 files changed, 5 insertions, 4 deletions
diff --git a/Source/VCGeneration/ConditionGeneration.cs b/Source/VCGeneration/ConditionGeneration.cs
index edab3bf8..202557ff 100644
--- a/Source/VCGeneration/ConditionGeneration.cs
+++ b/Source/VCGeneration/ConditionGeneration.cs
@@ -261,10 +261,11 @@ namespace Microsoft.Boogie {
var cs = m.MkState(map.Description);
foreach (Variable v in MvInfo.AllVariables) {
- var e = (Expr)map.IncarnationMap[v];
+ Expr e = map.IncarnationMap.ContainsKey(v) ? map.IncarnationMap[v] : null;
if (e == null) continue;
- if (prevInc[v] == e) continue; // skip unchanged variables
+ Expr prevIncV = prevInc.ContainsKey(v) ? prevInc[v] : null;
+ if (prevIncV == e) continue; // skip unchanged variables
Model.Element elt;
@@ -1254,7 +1255,7 @@ namespace VC {
Dictionary<Variable, Expr> predMap = (Dictionary<Variable, Expr>)cce.NonNull(block2Incarnation[pred]);
Expr pred_incarnation_exp;
- Expr o = (Expr)predMap[v];
+ Expr o = predMap.ContainsKey(v) ? predMap[v] : null;
if (o == null) {
Variable predIncarnation = v;
IdentifierExpr ie2 = new IdentifierExpr(predIncarnation.tok, predIncarnation);
diff --git a/Source/VCGeneration/VC.cs b/Source/VCGeneration/VC.cs
index bf2bf324..09874382 100644
--- a/Source/VCGeneration/VC.cs
+++ b/Source/VCGeneration/VC.cs
@@ -1751,7 +1751,7 @@ namespace VC {
foreach (Block b in returnExample.Trace) {
Contract.Assert(b != null);
Contract.Assume(b.TransferCmd != null);
- ReturnCmd cmd = (ReturnCmd)gotoCmdOrigins[b.TransferCmd];
+ ReturnCmd cmd = gotoCmdOrigins.ContainsKey(b.TransferCmd) ? gotoCmdOrigins[b.TransferCmd] : null;
if (cmd != null) {
returnExample.FailingReturn = cmd;
break;