Browse Source

Fix DetectPinnedRegions.SplitBlocksAtWritesToPinnedLocals creating blocks without ILRange.

These blocks could trigger assertions if LoopDetection was creating a loop BlockContainer from them (BlockContainers have an assertion requiring an ILRange).

Closes #2533 and #2457.
pull/2549/head
Daniel Grunwald 4 years ago
parent
commit
df339e72fb
  1. 1
      ICSharpCode.Decompiler/IL/ControlFlow/DetectPinnedRegions.cs

1
ICSharpCode.Decompiler/IL/ControlFlow/DetectPinnedRegions.cs

@ -143,6 +143,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow @@ -143,6 +143,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
var newBlock = new Block();
newBlock.Instructions.Add(block.Instructions[j]);
newBlock.Instructions.Add(block.Instructions[j + 1]);
newBlock.AddILRange(newBlock.Instructions[0]);
Debug.Assert(block.Instructions.Count == j + 2);
block.Instructions.RemoveRange(j, 2);
block.Instructions.Insert(j, new Branch(newBlock));

Loading…
Cancel
Save