Skip to content

x86: Assertion failed '!"Too many unreachable block removal loops"' during 'Global local var liveness' #70786

@EgorBo

Description

@EgorBo

Fuzzlyn found it in #70749

Reproduces on 32bit alt jit x86

// Generated by Fuzzlyn v1.5 on 2022-06-15 12:29:54
// Run on X86 Windows
// Seed: 5780366890582234972
// Reduced from 39.2 KiB to 2.6 KiB in 00:03:56
// Hits JIT assert in Release:
// Assertion failed '!"Too many unreachable block removal loops"' in 'Program:M0()' during 'Global local var liveness' (IL size 257; hash 0xaf50ff37; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\fgopt.cpp Line: 747
// 
public interface I0
{
}

public interface I1
{
}

public struct S0 : I0, I1
{
    public int F0;
    public sbyte F1;
    public byte F2;
    public bool F3;
    public byte F4;
    public sbyte F5;
    public byte F6;
    public uint F7;
    public ulong F8;
    public byte F9;
    public S0(int f0, sbyte f1, byte f2, bool f3, byte f4, sbyte f5, byte f6, uint f7, ulong f8, byte f9): this()
    {
        F0 = f0;
        F1 = f1;
        F2 = f2;
        F3 = f3;
        F4 = f4;
        F5 = f5;
        F6 = f6;
        F7 = f7;
        F8 = f8;
        F9 = f9;
    }
}

public class Program
{
    public static I0 s_3;
    public static S0 s_5;
    public static long s_8;
    public static short s_10;
    public static int[] s_12;
    public static I1 s_21;
    public static void Main()
    {
        M0();
    }

    public static void M0()
    {
        int var0 = default(int);
        uint var1 = default(uint);
        bool var43 = default(bool);
        for (int var6 = 0; var6 < 1; var6++)
        {
            return;
        }

        try
        {
            var0 = -var0;
        }
        finally
        {
            I1 vr2 = s_5;
            short vr3 = default(short);
            if (0 < vr3)
            {
                var vr0 = new S0(0, 0, 0, true, 1, 0, 0, 0, 0, 0);
            }
            else
            {
                short var10 = (short)var1;
            }
        }

        System.Console.WriteLine(var0);
        try
        {
            s_8 = s_5.F4;
        }
        finally
        {
            var vr1 = new S0(0, 0, 0, false, 1, 0, 0, 0, 0, 0);
        }

        try
        {
            var0 <<= s_10;
        }
        finally
        {
            s_3 = new S0(0, 0, 0, true, 0, 0, 0, 0, 0, 0);
        }

        s_8 = 0;
        try
        {
            var0--;
        }
        finally
        {
            var1 = 0;
        }

        S0 var17 = new S0(0, 0, 0, false, 0, -1, 0, 0, 0, 0);
        try
        {
            System.Console.WriteLine(1);
        }
        finally
        {
            int var14 = s_12[0];
        }

        try
        {
            M2();
        }
        finally
        {
            System.Console.WriteLine(var43);
        }

        try
        {
            M1();
        }
        finally
        {
            s_21 = var17;
        }
    }

    public static long M1()
    {
        return 0;
    }

    public static short M2()
    {
        return default(short);
    }
}

cc @jakobbotsch in case if you already filed this

category:implementation
theme:flowgraph
skill-level:intermediate
cost:small
impact:small

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