dotnet / runtime

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

JIT: Assertion failed 'unreached' during `Importation` #106372

Closed amanasifkhalid closed 2 weeks ago

amanasifkhalid commented 1 month ago

On Windows x86:

// Found by Antigen
// Reduced from 161.42 KB to 874 B.

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
{
    static long s_long_11 = 1;
    static Vector128<int> s_v128_int_33 = Vector128.Create(-5, -5, 1, -5);
    Vector128<int> v128_int_83 = Vector128.Create(-5);
    Vector128<long> v128_long_85 = Vector128.Create((long)-1);
    public void Method0()
    {
        unchecked
        {
            AdvSimd.AddWideningUpper((15|4)* (v128_long_85 *= Vector128.CreateSequence(s_long_11, -2)), v128_int_83 + v128_int_83 | s_v128_int_33| v128_int_83 + s_v128_int_33- Vector128<int>.AllBitsSet - s_v128_int_33);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
}
/*
Got output diff:
--------- Baseline ---------  

Environment:

--------- Test ---------  

Environment:

Assert failure(PID 35056 [0x000088f0], Thread: 28500 [0x6f54]): Assertion failed 'unreached' in 'TestClass:Method0():this' during 'Importation' (IL size 116; hash 0x46e9aa75; Tier0)
    File: C:\wk\runtime\src\coreclr\jit\gentree.cpp:22552
    Image: C:\wk\runtime\artifacts\tests\coreclr\windows.x86.Checked\Tests\Core_Root\corerun.exe
*/
dotnet-policy-service[bot] commented 1 month ago

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

AndyAyersMS commented 1 month ago

Hitting this bit of code in gtNewSimdCreateBroadcastNode

    if (varTypeIsLong(simdBaseType) && !op1->IsIntegralConst())
    {
        // TODO-XARCH-CQ: It may be beneficial to emit the movq
        // instruction, which takes a 64-bit memory address and
        // works on 32-bit x86 systems.
        unreached();
    }
#endif // TARGET_X86
AndyAyersMS commented 3 weeks ago

@tannergooding FYI