Skip to content

Assertion failed 'bbNumTryLast <= bbNumOuterTryLast' during 'Optimize layout' #108608

@kunalspathak

Description

@kunalspathak

Repro on windows/x64:

// Found by Antigen
// Reduced from 246.98 KB to 7.53 KB.


using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
using System.Numerics;
public class TestClass
{
    public struct S2
    {
    }
    static char s_char_5 = 'J';
    static int s_int_9 = 5;
    static Vector128<ushort> s_v128_ushort_21 = Vector128<ushort>.Zero;
    static Vector128<float> s_v128_float_26 = Vector128.CreateScalar(-4.955224f);
    static Vector256<ushort> s_v256_ushort_31 = Vector256<ushort>.Zero;
    string string_73 = "TIKBS";
    S2 s2_122 = new S2();
    static int s_loopInvariant = 9;
    private static List<string> toPrint = new List<string>();
    [MethodImpl(MethodImplOptions.NoInlining)]
    public char LeafMethod2()
    {
        unchecked
        {
            return s_char_5;
        }
    }
    public void Method0()
    {
        unchecked
        {
            bool bool_173 = false;
            int int_179 = 1;
            switch (15/4)
            {
                case -5:
                {
                    break;
                }
                default:
                {
                    switch (s_char_5 = LeafMethod2())
                    {
                        case 'V':
                        {
                            try
                            {
                                for (; int_179 < 15*4; int_179++)
                                {
                                    switch (s_int_9 -= s_int_9)
                                    {
                                        case -1:
                                        {
                                            break;
                                        }
                                        case -2:
                                        {
                                            break;
                                        }
                                        case 5:
                                        {
                                            break;
                                        }
                                        case 1:
                                        {
                                            break;
                                        }
                                        case -2147483647:
                                        {
                                            switch ("A9EET" + "F1"+ (string_73 = "A9EET" + "F1")+ (string_73 = "A9EET" + "F1"+ (string_73 = "A9EET" + "F1")))
                                            {
                                                case "T0X4TEN23":
                                                {
                                                    break;
                                                }
                                                case "2G8A35G88":
                                                {
                                                    break;
                                                }
                                                case "A9EET":
                                                {
                                                    try
                                                    {
                                                        Vector512.AsSingle(15*4* Vector512<long>.AllBitsSet);
                                                    }
                                                    finally
                                                    {
                                                        Vector256.WithUpper(s_v256_ushort_31 += s_v256_ushort_31, s_v128_ushort_21);
                                                    }
                                                    break;
                                                }
                                                case "F1":
                                                {
                                                    break;
                                                }
                                                case "S":
                                                {
                                                    break;
                                                }
                                                case "IXTF":
                                                {
                                                    break;
                                                }
                                                case "O9FXYE":
                                                {
                                                    break;
                                                }
                                                default:
                                                {
                                                    break;
                                                }
                                            }
                                            break;
                                        }
                                        case -5:
                                        {
                                            if (Sse.CompareScalarUnorderedGreaterThan(s_v128_float_26 -= s_v128_float_26- (s_v128_float_26 += s_v128_float_26), s_v128_float_26 -= s_v128_float_26- (s_v128_float_26 += s_v128_float_26)))
                                            {
                                            }
                                            else
                                            {
                                            }
                                            break;
                                        }
                                        case 2147483646:
                                        {
                                            break;
                                        }
                                        case 0:
                                        {
                                            break;
                                        }
                                        default:
                                        {
                                            try
                                            {
                                                s2_122 = s2_122;
                                            }
                                            catch (System.MissingMemberException)
                                            {
                                            }
                                            break;
                                        }
                                    }
                                }
                            }
                            finally
                            {
                                if (bool_173 = 15>4)
                                {
                                    int __loopvar13 = s_loopInvariant, __loopSecondaryVar13_0 = 15-4;
                                }
                                else
                                {
                                }
                            }
                            break;
                        }
                        default:
                        {
                            break;
                        }
                    }
                    break;
                }
            }
            return;
        }
    }
    public static void Main(string[] args)
    {
    }
    public static int Antigen()
    {
        new TestClass().Method0();
        return string.Join(Environment.NewLine, toPrint).GetHashCode();
    }
}
/*
Environment:

set DOTNET_ReadyToRun=1
set DOTNET_JitObjectStackAllocation=1
set DOTNET_JitRandomOnStackReplacement=10
set DOTNET_JitVTableProfiling=1
set DOTNET_TC_OnStackReplacement=1
set DOTNET_TC_PartialCompilation=1
set DOTNET_TC_QuickJitForLoops=1
set DOTNET_TieredCompilation=0
set DOTNET_TieredPGO=1
set DOTNET_JitStress=2
set DOTNET_JitThrowOnAssertionFailure=1
set DOTNET_LegacyExceptionHandling=1

Debug: 1631896427

Release: 0
JIT assert failed:
Assertion failed 'bbNumTryLast <= bbNumOuterTryLast' in 'TestClass:Method0():this' during 'Optimize layout' (IL size 635; hash 0x46e9aa75; FullOpts)

    File: D:\a\_work\1\s\src\coreclr\jit\jiteh.cpp Line: 3193


*/

Metadata

Metadata

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions