dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.47k stars 4.76k forks source link

windows/x64: Assertion failed 'unreached' during 'Physical promotion' #110326

Open kunalspathak opened 1 day ago

kunalspathak commented 1 day ago
// Found by Antigen
// Reduced from 37.21 KB to 3.82 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 S1
    {
        public Vector<double> v_double_0;
    }
    public struct S2
    {
        public struct S2_D1_F2
        {
            public struct S2_D2_F1
            {
            }
            public struct S2_D2_F2
            {
                public S1 s1_7;
            }
            public struct S2_D2_F3
            {
                public Vector3 v3_10;
            }
        }
        public struct S2_D1_F3
        {
            public struct S2_D2_F3
            {
                public Vector256<int> v256_int_14;
            }
            public Vector128<long> v128_long_13;
            public Vector512<uint> v512_uint_16;
        }
    }
    public struct S3
    {
    }
    public struct S4
    {
        public struct S4_D1_F1
        {
            public struct S4_D2_F3
            {
            }
            public S2.S2_D1_F3 s2_s2_d1_f3_19;
        }
    }
    public struct S5
    {
    }
    static Vector512<uint> s_v512_uint_63 = Vector512.CreateScalar((uint)5);
    S4.S4_D1_F1 s4_s4_d1_f1_162 = new S4.S4_D1_F1();
    private static List<string> toPrint = new List<string>();
    public void Method0()
    {
        unchecked
        {
            double double_248 = -1.9610389610389611;
            short short_249 = 2;
            string string_254 = "QM2DZ5IX";
            ushort ushort_255 = 2;
            ulong ulong_257 = 5;
            S1 s1_259 = new S1();
            S2.S2_D1_F2.S2_D2_F1 s2_s2_d1_f2_s2_d2_f1_260 = new S2.S2_D1_F2.S2_D2_F1();
            S2.S2_D1_F2.S2_D2_F1 s2_s2_d1_f2_s2_d2_f1_261 = s2_s2_d1_f2_s2_d2_f1_260;
            S2.S2_D1_F2.S2_D2_F2 s2_s2_d1_f2_s2_d2_f2_262 = new S2.S2_D1_F2.S2_D2_F2();
            S2.S2_D1_F2.S2_D2_F2 s2_s2_d1_f2_s2_d2_f2_263 = s2_s2_d1_f2_s2_d2_f2_262;
            S2.S2_D1_F2.S2_D2_F3 s2_s2_d1_f2_s2_d2_f3_264 = new S2.S2_D1_F2.S2_D2_F3();
            S2.S2_D1_F2.S2_D2_F3 s2_s2_d1_f2_s2_d2_f3_265 = s2_s2_d1_f2_s2_d2_f3_264;
            S2.S2_D1_F2 s2_s2_d1_f2_266 = new S2.S2_D1_F2();
            S2.S2_D1_F3.S2_D2_F3 s2_s2_d1_f3_s2_d2_f3_268 = new S2.S2_D1_F3.S2_D2_F3();
            S2.S2_D1_F3 s2_s2_d1_f3_269 = new S2.S2_D1_F3();
            S2.S2_D1_F3 s2_s2_d1_f3_270 = s2_s2_d1_f3_269;
            S4.S4_D1_F1 s4_s4_d1_f1_276 = new S4.S4_D1_F1();
            s2_s2_d1_f3_270.v512_uint_16 = Vector512.IsZero(s_v512_uint_63 = s4_s4_d1_f1_162.s2_s2_d1_f3_19.v512_uint_16 * s4_s4_d1_f1_276.s2_s2_d1_f3_19.v512_uint_16);
            Log("double_248", double_248);
            Log("short_249", short_249);
            Log("string_254", string_254);
            Log("ushort_255", ushort_255);
            Log("ulong_257", ulong_257);
            Log("s1_259", s1_259);
            Log("s2_s2_d1_f", s2_s2_d1_f2_s2_d2_f2_262.s1_7.v_double_0);
            Log("s2_s2_d1_f", s2_s2_d1_f2_s2_d2_f2_263.s1_7.v_double_0);
            Log("s2_s2_d1_f", s2_s2_d1_f2_s2_d2_f1_260);
            Log("s2_s2_d1_f", s2_s2_d1_f2_s2_d2_f1_261);
            Log("s2_s2_d1_f", s2_s2_d1_f2_s2_d2_f3_264);
            Log("s2_s2_d1_f", s2_s2_d1_f2_s2_d2_f3_265.v3_10);
            Log("s2_s2_d1_f", s2_s2_d1_f2_266);
            Log("s2_s2_d1_f", s2_s2_d1_f3_s2_d2_f3_268.v256_int_14);
            Log("s2_s2_d1_f", s2_s2_d1_f3_269.v128_long_13);
            Log("s2_s2_d1_f", s2_s2_d1_f3_270.v128_long_13);
            return;
        }
    }
    public static void Main(string[] args)
{}
    public static int Antigen()
    {
        new TestClass().Method0();
        return string.Join(Environment.NewLine, toPrint).GetHashCode();
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void Log(string varName, object varValue)
    {
    }
}
/*
Environment:

set DOTNET_JitProfileCasts=1
set DOTNET_JitAggressiveInlining=0
set DOTNET_HeapVerify=1
set DOTNET_TieredCompilation=0
set DOTNET_PreferredVectorBitWidth=512
set DOTNET_JitStress=2
set DOTNET_JitThrowOnAssertionFailure=1
set DOTNET_LegacyExceptionHandling=1

Debug: -899992286

Release: 0
JIT assert failed:
Assertion failed 'unreached' in 'TestClass:Method0():this' during 'Physical promotion' (IL size 459; hash 0x46e9aa75; FullOpts)

    File: D:\a\_work\1\s\src\coreclr\jit\gentree.cpp Line: 8260

*/
kunalspathak commented 1 day ago

@dotnet/jit-contrib

dotnet-policy-service[bot] commented 1 day ago

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

amanasifkhalid commented 1 day ago

I'm not able to repro this failure locally, though I suspect all these unreached() asserts from the last Antigen run were introduced by #110195, and might be fixed by #110307. I'll kick off a new run to check.

amanasifkhalid commented 10 hours ago

A similar unreached() assertion hit in the latest Antigen run, so looks like #110307 didn't fix it. cc @tannergooding