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. 12
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Unsafe.cs

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

@ -40,20 +40,10 @@ internal sealed class ExtraUnsafeTests @@ -40,20 +40,10 @@ internal sealed class ExtraUnsafeTests
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.
byte[] array;
if ((array = arr) != null && array.Length != 0)
{
fixed (byte* ptr = &array[0])
fixed (byte* ptr = arr)
{
*(int*)ptr = val;
}
}
else
{
/*pinned*/ref byte reference = ref *(byte*)null;
*(int*)Unsafe.AsPointer(ref reference) = val;
}
return arr;
}

Loading…
Cancel
Save