Skip to content

JIT: Byref store after suspension-point removed in runtime async #116090

Description

@jakobbotsch
// Generated by Fuzzlyn v3.2 on 2025-05-29 10:39:18
// Run on X64 Windows
// Seed: 2491652614975848521-async,runtimeasync,vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86pclmulqdqv256,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base
// Reduced from 151.4 KiB to 1.6 KiB in 00:00:53
// Release: Runs successfully
// Release with Runtime Async: Throws 'System.NullReferenceException'
using System;
using System.Numerics;
using System.Threading.Tasks;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static IRuntime s_rt;
    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)
    {
        s_rt = rt;
        M0().GetAwaiter().GetResult();
    }

    public static async Task M0()
    {
        Vector256<int> var2 = default(Vector256<int>);
        for (ulong lvar0 = 2UL; lvar0 > 0UL; lvar0--)
        {
            await Task.Yield();
            Vector256<ulong>[] var1 = new Vector256<ulong>[]
            {
                Vector256.Create<ulong>(0)
            };
            s_rt.WriteLine("c_0", var2);
            s_rt.WriteLine("c_1", var1[0]);
            await Task.Yield();
            s_rt.WriteLine("c_2", lvar0);
        }
    }
}

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

Metadata

Metadata

Assignees

Labels

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

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions