Browse Source

Fix #1460: assertion in DataFlowVisitor`1.DebugPoint() with try-fault statement.

pull/1476/head
Daniel Grunwald 6 years ago
parent
commit
2929ae865f
  1. 11
      ICSharpCode.Decompiler/FlowAnalysis/DataFlowVisitor.cs

11
ICSharpCode.Decompiler/FlowAnalysis/DataFlowVisitor.cs

@ -235,9 +235,10 @@ namespace ICSharpCode.Decompiler.FlowAnalysis @@ -235,9 +235,10 @@ namespace ICSharpCode.Decompiler.FlowAnalysis
#if DEBUG
Debug.Assert(initialized, "Initialize() was not called");
State previousOutputState;
if (debugDict.TryGetValue(inst, out previousOutputState)) {
Debug.Assert(previousOutputState.LessThanOrEqual(state));
State previousState;
if (debugDict.TryGetValue(inst, out previousState)) {
Debug.Assert(previousState.LessThanOrEqual(state));
previousState.JoinWith(state);
} else {
// limit the number of tracked instructions to make memory usage in debug builds less horrible
if (debugDict.Count < 1000) {
@ -492,7 +493,9 @@ namespace ICSharpCode.Decompiler.FlowAnalysis @@ -492,7 +493,9 @@ namespace ICSharpCode.Decompiler.FlowAnalysis
// so propagate the state:
oldStateOnException.JoinWith(newStateOnException);
return newStateOnException;
// Return a copy, so that the caller mutating the returned state
// does not influence the 'stateOnException' dict
return newStateOnException.Clone();
}
protected internal override void VisitTryCatch(TryCatch inst)

Loading…
Cancel
Save