Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Assertion failed 'tree->gtVNPair.BothDefined() || tree->OperIs(GT_PHI_ARG)' during 'Do value numbering' #81688

Closed
jakobbotsch opened this issue Feb 6, 2023 · 2 comments
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@jakobbotsch
Copy link
Member

// Generated by Fuzzlyn v1.5 on 2023-02-05 18:35:15
// Run on X86 Windows
// Seed: 5123563567841620061
// Reduced from 103.5 KiB to 1.7 KiB in 00:02:17
// Hits JIT assert in Release:
// Assertion failed 'tree->gtVNPair.BothDefined() || tree->OperIs(GT_PHI_ARG)' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Do value numbering' (IL size 57; hash 0xade6b36b; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\valuenum.cpp Line: 11371
// 
public class Program
{
    public static ushort s_2;
    public static sbyte s_6;
    public static byte[] s_17;
    public static byte s_18;
    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)
    {
        for (int vr4 = 0; vr4 < 0; vr4++)
        {
            byte vr5 = (byte)s_2;
            if (vr5 <= -1)
            {
                try
                {
                    sbyte vr8 = s_6;
                }
                finally
                {
                    vr5 = s_17[0];
                }
            }
            else
            {
                try
                {
                    s_18 = vr5;
                }
                finally
                {
                    M19();
                }
            }
        }
    }

    public static byte M19()
    {
        return default(byte);
    }
}

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

Bisected to #79771, @SingleAccretion said they would take a look

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 6, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Feb 6, 2023
@jakobbotsch jakobbotsch removed the untriaged New issue has not been triaged by the area owner label Feb 6, 2023
@ghost
Copy link

ghost commented Feb 6, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak
See info in area-owners.md if you want to be subscribed.

Issue Details
// Generated by Fuzzlyn v1.5 on 2023-02-05 18:35:15
// Run on X86 Windows
// Seed: 5123563567841620061
// Reduced from 103.5 KiB to 1.7 KiB in 00:02:17
// Hits JIT assert in Release:
// Assertion failed 'tree->gtVNPair.BothDefined() || tree->OperIs(GT_PHI_ARG)' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Do value numbering' (IL size 57; hash 0xade6b36b; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\valuenum.cpp Line: 11371
// 
public class Program
{
    public static ushort s_2;
    public static sbyte s_6;
    public static byte[] s_17;
    public static byte s_18;
    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)
    {
        for (int vr4 = 0; vr4 < 0; vr4++)
        {
            byte vr5 = (byte)s_2;
            if (vr5 <= -1)
            {
                try
                {
                    sbyte vr8 = s_6;
                }
                finally
                {
                    vr5 = s_17[0];
                }
            }
            else
            {
                try
                {
                    s_18 = vr5;
                }
                finally
                {
                    M19();
                }
            }
        }
    }

    public static byte M19()
    {
        return default(byte);
    }
}

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

Bisected to #79771, @SingleAccretion said they would take a look

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr, untriaged

Milestone: -

@SingleAccretion
Copy link
Contributor

Fixed by #82329.

@SingleAccretion SingleAccretion removed their assignment Apr 20, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

No branches or pull requests

2 participants