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

Assertion failed 'vnWx != NoVN' during 'Redundant branch opts' #72767

Closed
jakobbotsch opened this issue Jul 25, 2022 · 2 comments · Fixed by #76040
Closed

Assertion failed 'vnWx != NoVN' during 'Redundant branch opts' #72767

jakobbotsch opened this issue Jul 25, 2022 · 2 comments · Fixed by #76040
Assignees
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 2022-07-24 16:52:25
// Run on X86 Windows
// Seed: 11775672037815743472
// Reduced from 302.0 KiB to 1.4 KiB in 00:06:35
// Hits JIT assert in Release:
// Assertion failed 'vnWx != NoVN' in 'Program:M71()' during 'Redundant branch opts' (IL size 136; hash 0x996ec7e1; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\valuenum.cpp Line: 1306
// 
public struct S0
{
    public short F0;
    public sbyte F1;
    public S0(short f0, sbyte f1): this()
    {
        F0 = f0;
        F1 = f1;
    }
}

public struct S1
{
    public ushort F0;
    public uint F2;
    public S0 F3;
    public S0 F4;
    public int F5;
    public S1(ushort f0, uint f2, S0 f3, S0 f4, int f5): this()
    {
        F0 = f0;
        F2 = f2;
        F4 = f4;
        F5 = f5;
    }
}

public class Program
{
    public static bool[] s_7;
    public static sbyte s_26;
    public static S0[] s_44;
    public static void Main()
    {
        M71();
    }

    public static void M71()
    {
        var vr5 = (0 != s_26) || s_7[0];
        S1 vr20 = default(S1);
        for (int var15 = 0; var15 < 1; var15++)
        {
            return;
        }

        var vr7 = new S0(0, 0);
        if (!M81(true))
        {
            for (int var16 = 0; var16 < 0; var16++)
            {
                try
                {
                    System.Console.WriteLine(vr20.F3.F0);
                }
                finally
                {
                    var vr2 = new S1(0, 0, new S0(0, 0), new S0(0, 0), 0);
                }
            }
        }

        if (s_7[0])
        {
            s_44 = s_44;
        }
    }

    public static bool M81(bool arg0)
    {
        return arg0;
    }
}

Looks like another "unreachable code" example so will put it in 8.0 milestone.

cc @dotnet/jit-contrib

@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 Jul 25, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 25, 2022
@jakobbotsch jakobbotsch added this to the 8.0.0 milestone Jul 25, 2022
@ghost
Copy link

ghost commented Jul 25, 2022

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

Issue Details
// Generated by Fuzzlyn v1.5 on 2022-07-24 16:52:25
// Run on X86 Windows
// Seed: 11775672037815743472
// Reduced from 302.0 KiB to 1.4 KiB in 00:06:35
// Hits JIT assert in Release:
// Assertion failed 'vnWx != NoVN' in 'Program:M71()' during 'Redundant branch opts' (IL size 136; hash 0x996ec7e1; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\valuenum.cpp Line: 1306
// 
public struct S0
{
    public short F0;
    public sbyte F1;
    public S0(short f0, sbyte f1): this()
    {
        F0 = f0;
        F1 = f1;
    }
}

public struct S1
{
    public ushort F0;
    public uint F2;
    public S0 F3;
    public S0 F4;
    public int F5;
    public S1(ushort f0, uint f2, S0 f3, S0 f4, int f5): this()
    {
        F0 = f0;
        F2 = f2;
        F4 = f4;
        F5 = f5;
    }
}

public class Program
{
    public static bool[] s_7;
    public static sbyte s_26;
    public static S0[] s_44;
    public static void Main()
    {
        M71();
    }

    public static void M71()
    {
        var vr5 = (0 != s_26) || s_7[0];
        S1 vr20 = default(S1);
        for (int var15 = 0; var15 < 1; var15++)
        {
            return;
        }

        var vr7 = new S0(0, 0);
        if (!M81(true))
        {
            for (int var16 = 0; var16 < 0; var16++)
            {
                try
                {
                    System.Console.WriteLine(vr20.F3.F0);
                }
                finally
                {
                    var vr2 = new S1(0, 0, new S0(0, 0), new S0(0, 0), 0);
                }
            }
        }

        if (s_7[0])
        {
            s_44 = s_44;
        }
    }

    public static bool M81(bool arg0)
    {
        return arg0;
    }
}

Looks like another "unreachable code" example so will put it in 8.0 milestone.

cc @dotnet/jit-contrib

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 25, 2022
@AndyAyersMS
Copy link
Member

Seems like an issue introduced when we added fgGetDomSpeculatively in #70907. I think I can tweak that method not to be as easily fooled by unreachable code.

AndyAyersMS added a commit to AndyAyersMS/runtime that referenced this issue Sep 22, 2022
Update `fgGetDomSpeculatively` to return nullptr if the idom of a block is
unreachable, even if other preds have refs.

Fixes dotnet#72767.
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Sep 22, 2022
@AndyAyersMS AndyAyersMS self-assigned this Sep 22, 2022
AndyAyersMS added a commit that referenced this issue Sep 23, 2022
Update `fgGetDomSpeculatively` to return nullptr if the idom of a block is
unreachable, even if other preds have refs.

Fixes #72767.
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 23, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 23, 2022
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

Successfully merging a pull request may close this issue.

2 participants