Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4631,6 +4631,7 @@ void CodeGen::genCheckUseBlockInit()
if (!varDsc->lvIsInReg() && !varDsc->lvOnFrame)
{
noway_assert(varDsc->lvRefCnt() == 0);
varDsc->lvMustInit = 0;
continue;
}

Expand All @@ -4643,6 +4644,7 @@ void CodeGen::genCheckUseBlockInit()

if (compiler->fgVarIsNeverZeroInitializedInProlog(varNum))
{
varDsc->lvMustInit = 0;
continue;
}

Expand All @@ -4651,6 +4653,7 @@ void CodeGen::genCheckUseBlockInit()
// For Compiler::PROMOTION_TYPE_DEPENDENT type of promotion, the whole struct should have been
// initialized by the parent struct. No need to set the lvMustInit bit in the
// field locals.
varDsc->lvMustInit = 0;
continue;
}

Expand Down
81 changes: 81 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_64808/Runtime_64808.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// 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;

// Generated by Fuzzlyn v1.5 on 2022-02-03 20:05:52
// Run on X64 Linux
// Seed: 17645686525285880576
// Reduced from 66.2 KiB to 1.0 KiB in 00:04:27
// Hits JIT assert in Release:
// Assertion failed 'compiler->opts.IsOSR() || ((genInitStkLclCnt > 0) == hasUntrLcl)' in 'Program:M8():S0' during 'Generate code' (IL size 110)
//
// File: /__w/1/s/src/coreclr/jit/codegencommon.cpp Line: 7256
//

public class C0
{
public int F0;
public ulong F1;
public sbyte F2;
}

public struct S0
{
public int F0;
public S0(int f0): this()
{
}
}

public class Runtime_64808
{
private static IRT s_rt;
public static long[] s_16;
public static bool s_23;
public static int s_result;
public static int Main()
{
s_16 = new long[1];
s_rt = new C();
s_result = -1;
M8();
return s_result;
}

public static S0 M8()
{
try
{
var vr0 = new ushort[]{0};
C0[] vr3 = default(C0[]);
return M15(vr0, ref s_23, vr3);
}
finally
{
var vr2 = new S0[]{new S0(0), new S0(0), new S0(0), new S0(0), new S0(0), new S0(0)};
}
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static S0 M15(ushort[] arg0, ref bool arg1, C0[] arg2)
{
s_result = 100;
S0 vr5 = default(S0);
return vr5;
}
}

public interface IRT
{
void WriteLine<T>(string a, T value);
}

public class C : IRT
{
public void WriteLine<T>(string a, T value)
{
System.Console.WriteLine(value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>