Skip to content

Commit

Permalink
Make the detection of the unpin stloc more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
ElektroKill committed Nov 4, 2023
1 parent c6cf74f commit 0e64adc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ICSharpCode.Decompiler/IL/ControlFlow/DetectPinnedRegions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,8 @@ bool CreatePinnedRegion(Block block, StLoc stLoc)
{
unpinBlock = br.TargetBlock;
}
else if (innerBlock.Instructions[0].MatchIfInstruction(out _, out var trueInstr) &&
else if (innerBlock.Instructions.Count == 2 &&
innerBlock.Instructions[0].MatchIfInstruction(out _, out var trueInstr) &&
trueInstr is Branch trueBr && trueBr.TargetContainer == sourceContainer &&
reachedEdgesPerBlock[trueBr.TargetBlock.ChildIndex] == 0)
{
Expand Down

0 comments on commit 0e64adc

Please sign in to comment.