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 Jul 14, 2021
commit b9f9d39dc9091848581ba58909f4dad9826d9c35
45 changes: 45 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_55131/Runtime_55131.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;

public class Runtime_55131
{
// When merging the assertion props for the finally block, we should consider the assertions
// out of the BBJ_CALLFINALLY block. Otherwise, we could propagate the wrong assertions inside
// the finally block.
//
// Althogh there can be several ways to reproduce this problem, an easier way is to turn off
// finally cloning for below example.
[MethodImpl(MethodImplOptions.NoInlining)]
static bool False() => false;

static ushort s_6;
static uint[] s_15 = new uint[] { 0 };
static bool s_19 = false;
private static int Main()
{
bool condition = False();
int result = 100;
if (condition)
{
result -= 1;
}

try
{
if (condition)
{
result -= 1;
}
}
finally
{
if (condition)
{
result -= 1;
}
}
return result;
}
}
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>