Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test case
  • Loading branch information
kunalspathak committed Sep 2, 2021
commit 32632ce48a647fb8434c77b79156a3a9416b87ff
43 changes: 43 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_57912/Runtime_57912.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential)]
internal struct AA
{
public short tmp1;
public short q;

public ushort tmp2;
public int tmp3;

public AA(short qq)
{
tmp1 = 106;
tmp2 = 107;
tmp3 = 108;
q = qq;
}

// The test verifies that we accurately update the byref variable that is a field of struct.
public static short call_target_ref(ref short arg) { arg = 100; return arg; }
}


public class Runtime_57912
{

public static int Main()
{
return (int)test_0_17(100, new AA(100), new AA(0));
}

[MethodImpl(MethodImplOptions.NoInlining)]
static short test_0_17(int num, AA init, AA zero)
{
return AA.call_target_ref(ref init.q);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<DebugType>None</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
<PropertyGroup>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_JitEnableFinallyCloning=0
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
export DOTNET_JitEnableFinallyCloning=0
]]></BashCLRTestPreCommands>
</PropertyGroup>
</Project>