Browse Source

#2311: Adjust test case for #1292 -- fixed statement is now correctly detected

pull/2316/head
Daniel Grunwald 5 years ago
parent
commit
f2d3f259fd
  1. 14
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.cs

14
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.cs

@ -40,19 +40,9 @@ internal sealed class ExtraUnsafeTests
public unsafe static byte[] Issue1292(int val, byte[] arr) public unsafe static byte[] Issue1292(int val, byte[] arr)
{ {
//The blocks IL_0019 are reachable both inside and outside the pinned region starting at IL_0013. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. fixed (byte* ptr = arr)
byte[] array;
if ((array = arr) != null && array.Length != 0)
{ {
fixed (byte* ptr = &array[0]) *(int*)ptr = val;
{
*(int*)ptr = val;
}
}
else
{
/*pinned*/ref byte reference = ref *(byte*)null;
*(int*)Unsafe.AsPointer(ref reference) = val;
} }
return arr; return arr;
} }

Loading…
Cancel
Save