Skip to content

JIT: BBF_HAS_NULLCHECK is not set on BB but is required #71193

@jakobbotsch

Description

@jakobbotsch
// Generated by Fuzzlyn v1.5 on 2022-06-23 08:43:29
// Run on X86 Windows
// Seed: 5750726589836538152
// Reduced from 266.4 KiB to 1.7 KiB in 00:01:46
// Hits JIT assert in Release:
// Assertion failed 'false' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Early Value Propagation' (IL size 97; hash 0xade6b36b; FullOpts)
//
//     File: C:\dev\dotnet\runtime3\src\coreclr\jit\earlyprop.cpp Line: 63
//
public interface I0
{
}

public struct S0 : I0
{
    public sbyte F0;
}

public class Program
{
    public static long[] s_21;
    public static bool[] s_23;
    public static ushort s_28;
    public static S0 s_31;
    public static short s_35;
    public static S0 s_46;
    public static short s_58;
    public static uint[][] s_63;
    public static void Main()
    {
        CollectibleALC alc = new CollectibleALC();
        System.Reflection.Assembly asm = alc.LoadFromAssemblyPath(System.Reflection.Assembly.GetExecutingAssembly().Location);
        System.Reflection.MethodInfo mi = asm.GetType(typeof(Program).FullName).GetMethod(nameof(MainInner));
        System.Type runtimeTy = asm.GetType(typeof(Runtime).FullName);
        mi.Invoke(null, new object[]{System.Activator.CreateInstance(runtimeTy)});
    }

    public static void MainInner(IRuntime rt)
    {
        var vr6 = s_21[0];
        long[] vr9 = new long[]{0};
        var vr10 = new S0();
        var vr11 = new S0();
        var vr12 = s_63[0][0];
        Program.M85(vr10, ref s_58, s_31, M85(s_46, ref s_35, vr11, vr12, ref vr9[0]), ref vr6);
    }

    public static ref ushort M85(S0 argThis, ref short arg0, I0 arg1, uint arg2, ref long arg3)
    {
        if (s_23[0])
        {
            arg0 = arg0;
        }

        return ref s_28;
    }
}

public interface IRuntime
{
    void WriteLine<T>(string site, T value);
}

public class Runtime : IRuntime
{
    public void WriteLine<T>(string site, T value) => System.Console.WriteLine(value);
}

public class CollectibleALC : System.Runtime.Loader.AssemblyLoadContext
{
    public CollectibleALC(): base(true)
    {
    }
}
BBF_HAS_NULLCHECK is not set on BB01 but is required because of the following tree
N007 ( 22, 17) [000056] --CXG------                           NULLCHECK byte
N006 ( 21, 16) [000055] --CXG------                         └──▌  ADD       byref
N004 ( 19, 14) [000053] #-CXG------                            ├──▌  IND       ref
N003 ( 16, 12) [000050] H-CXG------                              └──▌  CALL help byref  HELPER.CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS Zero Fseq<NotAField>
N001 (  1,  4) [000048] ----------- arg0 in ecx                     ├──▌  CNS_INT   int    0x8B6C988
N002 (  1,  1) [000049] ----------- arg1 in edx                     └──▌  CNS_INT   int    0
N005 (  1,  1) [000054] -----------                            └──▌  CNS_INT   int    4 Fseq[s_31]

Assert failure(PID 23248 [0x00005ad0], Thread: 16572 [0x40bc]): Assertion failed 'false' in 'Program:MainInner(IRuntime)' during 'Early Value Propagation' (IL size 97; hash 0x34b1cb2a; FullOpts)

    File: C:\dev\dotnet\runtime2\src\coreclr\jit\earlyprop.cpp Line: 63
    Image: C:\dev\dotnet\runtime2\artifacts\tests\coreclr\windows.x86.Debug\Tests\Core_Root\corerun.exe

Reproduces on win-x64 too.

cc @dotnet/jit-contrib

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions