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
#if DEBUG #if DEBUG
Debug.Assert(initialized, "Initialize() was not called"); Debug.Assert(initialized, "Initialize() was not called");
State previousOutputState; State previousState;
if (debugDict.TryGetValue(inst, out previousOutputState)) { if (debugDict.TryGetValue(inst, out previousState)) {
Debug.Assert(previousOutputState.LessThanOrEqual(state)); Debug.Assert(previousState.LessThanOrEqual(state));
previousState.JoinWith(state);
} else { } else {
// limit the number of tracked instructions to make memory usage in debug builds less horrible // limit the number of tracked instructions to make memory usage in debug builds less horrible
if (debugDict.Count < 1000) { if (debugDict.Count < 1000) {
@ -492,7 +493,9 @@ namespace ICSharpCode.Decompiler.FlowAnalysis
// so propagate the state: // so propagate the state:
oldStateOnException.JoinWith(newStateOnException); 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) protected internal override void VisitTryCatch(TryCatch inst)

Loading…
Cancel
Save