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 'Contains(ancestor) && Contains(descendant)' during 'SSA: liveness' #110957

Open
kunalspathak opened this issue Dec 26, 2024 · 4 comments
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-mac-os-x macOS aka OSX untriaged New issue has not been triaged by the area owner

Comments

@kunalspathak
Copy link
Member

This is on osx/arm64, but I have seen failures in other platforms like linux/arm and windows/x64

// Found by Antigen
// Reduced from 30.59 KB to 2.86 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 struct S1_D1_F1
        {
            public struct S1_D2_F1
            {
                public bool bool_0;
            }
        }
    }
    public struct S2
    {
        public struct S2_D1_F1
        {
            public struct S2_D2_F2
            {
                public uint uint_5;
            }
        }
    }
    public struct S3
    {
        public S2.S2_D1_F1.S2_D2_F2 s2_s2_d1_f1_s2_d2_f2_12;
    }
    public struct S4
    {
        public double double_15;
    }
    public struct S5
    {
    }
    static int s_int_26 = 2;
    static uint s_uint_32 = 2;
    static Vector64<byte> s_v64_byte_35 = Vector64.CreateScalar((byte)1);
    static Vector64<float> s_v64_float_43 = Vector64<float>.AllBitsSet;
    static Vector64<double> s_v64_double_44 = Vector64.CreateScalar((double)-5);
    static Vector128<int> s_v128_int_49 = Vector128.Create(2);
    static S1 s_s1_70 = new S1();
    static S2.S2_D1_F1 s_s2_s2_d1_f1_72 = new S2.S2_D1_F1();
    static S3 s_s3_74 = new S3();
    S1.S1_D1_F1.S1_D2_F1 s1_s1_d1_f1_s1_d2_f1_125 = new S1.S1_D1_F1.S1_D2_F1();
    S2.S2_D1_F1.S2_D2_F2 s2_s2_d1_f1_s2_d2_f2_128 = new S2.S2_D1_F1.S2_D2_F2();
    S2 s2_130 = new S2();
    S4 s4_132 = new S4();
    S5 s5_133 = new S5();
    private static List<string> toPrint = new List<string>();
    public uint Method1(S5 p_s5_134, out S1 p_s1_135, S1 p_s1_136, out S2 p_s2_137, S2.S2_D1_F1 p_s2_s2_d1_f1_138, Vector128<int> p_v128_int_139, S2 p_s2_140, S1.S1_D1_F1.S1_D2_F1 p_s1_s1_d1_f1_s1_d2_f1_141, out double p_double_142)
    {
        unchecked
        {
            byte byte_144 = 2;
            p_double_142 = Vector64.Sum(s_v64_double_44 *= Vector64.WidenLower(s_v64_float_43));
            try
            {
                Vector64.AsUInt32(s_v64_byte_35 | s_v64_byte_35);
            }
            catch (System.MethodAccessException)
{}            finally
            {
                do
                {
                }
                while (s1_s1_d1_f1_s1_d2_f1_125.bool_0 = byte_144 > (byte_144 >>= s_int_26 >>= 79));
            }
            return s_s3_74.s2_s2_d1_f1_s2_d2_f2_12.uint_5 = s_uint_32;
        }
    }
    public void Method0()
    {
        unchecked
        {
            s2_s2_d1_f1_s2_d2_f2_128.uint_5 = Method1(s5_133, out s_s1_70, s_s1_70, out s2_130, s_s2_s2_d1_f1_72, s_v128_int_49 *= 15-4, s2_130, s1_s1_d1_f1_s1_d2_f1_125, out s4_132.double_15);
            return;
        }
    }
    public static void Main(string[] args)
    {
      Antigen();
    }
    public static int Antigen()
    {
        new TestClass().Method0();
        return string.Join(Environment.NewLine, toPrint).GetHashCode();
    }
}
/*
Environment:

set DOTNET_JitObjectStackAllocation=1
set DOTNET_TieredCompilation=0
set DOTNET_MaxVectorTBitWidth=128
set DOTNET_PreferredVectorBitWidth=0
set DOTNET_JitStress=2
set DOTNET_JitThrowOnAssertionFailure=1
set DOTNET_LegacyExceptionHandling=1

Debug: -1958815518

Release: 0
JIT assert failed:
Assertion failed 'Contains(ancestor) && Contains(descendant)' in 'TestClass:Method1(TestClass+S5,byref,TestClass+S1,byref,TestClass+S2+S2_D1_F1,System.Runtime.Intrinsics.Vector128`1[int],TestClass+S2,TestClass+S1+S1_D1_F1+S1_D2_F1,byref):uint:this' during 'SSA: liveness' (IL size 128; hash 0xbf8e1181; FullOpts)

    File: /Users/runner/work/1/s/src/coreclr/jit/flowgraph.cpp Line: 4288


*/
@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 Dec 26, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 26, 2024
Copy link
Contributor

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

@jakobbotsch
Copy link
Member

I cannot reproduce this on win-x64. What platform is this supposed to repro on?

@kunalspathak
Copy link
Member Author

I cannot reproduce this on win-x64. What platform is this supposed to repro on?

This is from osx/arm64 or any other arm64 platform

This is on osx/arm64,

@jakobbotsch
Copy link
Member

Ah thanks, not sure how I missed that.
Still can't repro with alt jit. Can you link or share one of the win-x64 examples?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-mac-os-x macOS aka OSX untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

2 participants