Skip to content

[Fuzzlyn] Assertion failed 'tgtIG' during 'Generate code'  #96224

Closed
@amanasifkhalid

Description

@amanasifkhalid

Last Fuzzlyn run failed on OS X ARM64 with the following assert:

Reduced example:

// Generated by Fuzzlyn v1.6 on 2023-12-24 17:50:10
// Run on Arm64 MacOS
// Seed: 17421103114350285504
// Reduced from 177.9 KiB to 1.7 KiB in 00:01:10
// Hits JIT assert in Release:
// Assertion failed 'tgtIG' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Generate code' (IL size 96; hash 0xade6b36b; FullOpts)
// 
//     File: /Users/runner/work/1/s/src/coreclr/jit/emit.cpp Line: 5174
// 
using System.Runtime.CompilerServices;

public class Program
{
    public static IRuntime s_rt;
    public static byte[] s_4;
    public static long s_25;
    public static bool s_29;
    public static ushort[] s_46;
    public static long s_59;
    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)
    {
        long[] vr5 = new long[]{0};
        for (int vr6 = 0; vr6 < 2; vr6++)
        {
            var vr7 = new int[]{1};
            vr5[0] = (M50(vr7) & 0) / (int)M58();
            s_rt.WriteLine("c_339", s_46[0]);
            s_rt.WriteLine("c_340", 5566640345371016742UL);
        }
    }

    public static int M50(int[] arg0)
    {
        if (s_29)
        {
            s_59 = s_25;
        }

        return arg0[0];
    }

    public static ulong M58()
    {
        s_4 = new byte[]{0};
        return 5566640345371016742UL;
    }
}

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)
    {
    }
}

cc @dotnet/jit-contrib, does anyone have an ARM64 Mac they can repro this failure on?

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIos-mac-os-xmacOS aka OSX

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions