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 'fldSeqForStaticVar->GetTail() == zeroOffsetFldSeq' during 'Do value numbering' #64773

Closed
kunalspathak opened this issue Feb 3, 2022 · 7 comments
Assignees
Labels
arch-x64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-linux Linux OS (any supported distro)
Milestone

Comments

@kunalspathak
Copy link
Member

// Found by Antigen
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S1
    {
        public struct S1_D1_F3
        {
            public decimal decimal_2;
        }
        public struct S1_D1_F4
        {
            public struct S1_D2_F3
            {
                public S1.S1_D1_F3 s1_s1_d1_f3_5;
            }
            public ulong ulong_3;
            public float float_4;
        }
        public ushort ushort_0;
        public int int_1;
    }
    public struct S2
    {
        public struct S2_D1_F1
        {
            public S1.S1_D1_F3 s1_s1_d1_f3_6;
        }
        public ulong ulong_7;
        public S1.S1_D1_F3 s1_s1_d1_f3_8;
        public float float_9;
    }
    public struct S3
    {
        public ulong ulong_10;
        public int int_11;
        public S2 s2_12;
    }
    public struct S4
    {
        public int int_13;
        public S1 s1_14;
    }
    public struct S5
    {
        public struct S5_D1_F3
        {
            public S1.S1_D1_F4.S1_D2_F3 s1_s1_d1_f4_s1_d2_f3_18;
            public S1.S1_D1_F4 s1_s1_d1_f4_19;
        }
        public byte byte_15;
    }
    static bool s_bool_20 = false;
    static byte s_byte_21 = 1;
    static decimal s_decimal_23 = 2.0857142857142857142857142857m;
    static short s_short_25 = 0;
    static int s_int_26 = 4;
    static long s_long_27 = 4;
    static sbyte s_sbyte_28 = 2;
    static ushort s_ushort_31 = 1;
    static uint s_uint_32 = 63;
    static S1.S1_D1_F3 s_s1_s1_d1_f3_34 = new S1.S1_D1_F3();
    static S1.S1_D1_F4.S1_D2_F3 s_s1_s1_d1_f4_s1_d2_f3_35 = new S1.S1_D1_F4.S1_D2_F3();
    static S1 s_s1_37 = new S1();
    static S2.S2_D1_F1 s_s2_s2_d1_f1_38 = new S2.S2_D1_F1();
    static S2 s_s2_39 = new S2();
    static S3 s_s3_40 = new S3();
    static S4 s_s4_41 = new S4();
    static S5.S5_D1_F3 s_s5_s5_d1_f3_42 = new S5.S5_D1_F3();
    static S5 s_s5_43 = new S5();
    byte byte_45 = 1;
    decimal decimal_47 = 4m;
    short short_49 = 1;
    int int_50 = 4;
    long long_51 = -1;
    sbyte sbyte_52 = 5;
    ushort ushort_55 = 0;
    uint uint_56 = 1;
    S1.S1_D1_F3 s1_s1_d1_f3_58 = new S1.S1_D1_F3();
    S1.S1_D1_F4.S1_D2_F3 s1_s1_d1_f4_s1_d2_f3_59 = new S1.S1_D1_F4.S1_D2_F3();
    S1.S1_D1_F4 s1_s1_d1_f4_60 = new S1.S1_D1_F4();
    S1 s1_61 = new S1();
    S2.S2_D1_F1 s2_s2_d1_f1_62 = new S2.S2_D1_F1();
    S2 s2_63 = new S2();
    S3 s3_64 = new S3();
    S4 s4_65 = new S4();
    S5.S5_D1_F3 s5_s5_d1_f3_66 = new S5.S5_D1_F3();
    S5 s5_67 = new S5();
    [MethodImpl(MethodImplOptions.NoInlining)]
    public decimal LeafMethod3()
    {
        unchecked
        {
            return s_decimal_23 /= 15+4;
        }
    }
    public short LeafMethod5()
    {
        unchecked
        {
            return short_49 |= 15|4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public int LeafMethod6()
    {
        unchecked
        {
            return s_s1_37.int_1 += 15|4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public long LeafMethod7()
    {
        unchecked
        {
            return long_51;
        }
    }
    public sbyte LeafMethod8()
    {
        unchecked
        {
            return (sbyte)(15<<4);
        }
    }
    public ushort LeafMethod11()
    {
        unchecked
        {
            return 15|4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public uint LeafMethod12()
    {
        unchecked
        {
            return uint_56 <<= s4_65.int_13 = 15+4;
        }
    }
    public ulong LeafMethod13()
    {
        unchecked
        {
            return s_s3_40.s2_12.ulong_7 |= 15&4;
        }
    }
    public S1.S1_D1_F4.S1_D2_F3 LeafMethod15()
    {
        unchecked
        {
            return s_s1_s1_d1_f4_s1_d2_f3_35;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public S5.S5_D1_F3 LeafMethod22()
    {
        unchecked
        {
            return s5_s5_d1_f3_66;
        }
    }
    public int Method1(ref S1.S1_D1_F3 p_s1_s1_d1_f3_68, S2.S2_D1_F1 p_s2_s2_d1_f1_69, out S2.S2_D1_F1 p_s2_s2_d1_f1_70, S1.S1_D1_F4 p_s1_s1_d1_f4_71, out S1.S1_D1_F4.S1_D2_F3 p_s1_s1_d1_f4_s1_d2_f3_72, S5 p_s5_73)
    {
        unchecked
        {
            S2.S2_D1_F1 s2_s2_d1_f1_95 = new S2.S2_D1_F1();
            S2.S2_D1_F1 s2_s2_d1_f1_96 = s2_s2_d1_f1_95;
            p_s2_s2_d1_f1_70 = s2_s2_d1_f1_96;
            p_s1_s1_d1_f4_s1_d2_f3_72 = s_s1_s1_d1_f4_s1_d2_f3_35;
            return s3_64.int_11;
        }
    }
    public S1.S1_D1_F3 Method2(decimal p_decimal_105, S1.S1_D1_F3 p_s1_s1_d1_f3_106)
    {
        unchecked
        {
            S1.S1_D1_F3 s1_s1_d1_f3_121 = new S1.S1_D1_F3();
            S1.S1_D1_F3 s1_s1_d1_f3_122 = s1_s1_d1_f3_121;
            return s1_s1_d1_f3_122;
        }
    }
    public void Method0()
    {
        unchecked
        {
            byte byte_155 = 63;
            short short_159 = 1;
            int int_160 = 1;
            long long_161 = 63;
            sbyte sbyte_162 = 63;
            float float_163 = -0.78947365f;
            ushort ushort_165 = 4;
            uint uint_166 = 1;
            S1.S1_D1_F3 s1_s1_d1_f3_168 = new S1.S1_D1_F3();
            S1.S1_D1_F3 s1_s1_d1_f3_169 = s1_s1_d1_f3_168;
            S1.S1_D1_F4.S1_D2_F3 s1_s1_d1_f4_s1_d2_f3_170 = new S1.S1_D1_F4.S1_D2_F3();
            S1.S1_D1_F4.S1_D2_F3 s1_s1_d1_f4_s1_d2_f3_171 = s1_s1_d1_f4_s1_d2_f3_170;
            S1.S1_D1_F4 s1_s1_d1_f4_172 = new S1.S1_D1_F4();
            S1 s1_173 = new S1();
            S1 s1_174 = s1_173;
            S2.S2_D1_F1 s2_s2_d1_f1_175 = new S2.S2_D1_F1();
            S2 s2_176 = new S2();
            S2 s2_177 = s2_176;
            S3 s3_178 = new S3();
            S3 s3_179 = s3_178;
            S4 s4_180 = new S4();
            S5.S5_D1_F3 s5_s5_d1_f3_181 = new S5.S5_D1_F3();
            S5 s5_182 = new S5();
            S5 s5_183 = s5_182;
            if (15*4!= 15/4+ s3_64.s2_12.float_9)
            {
            }
            else
            {
                if ((s3_64.s2_12.s1_s1_d1_f3_8.decimal_2 = LeafMethod3())+ LeafMethod3() - LeafMethod3()+ 63.075m + s_s5_s5_d1_f3_42.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2- s_s5_s5_d1_f3_42.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2<= (s_s1_s1_d1_f3_34.decimal_2 += s1_s1_d1_f3_58.decimal_2)/ (s2_63.s1_s1_d1_f3_8.decimal_2 / LeafMethod3()+ 19+ 92)% (s_s5_s5_d1_f3_42.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 + s_s1_s1_d1_f4_s1_d2_f3_35.s1_s1_d1_f3_5.decimal_2)* LeafMethod3()+ 1)
                {
                    switch (s4_65.int_13 ^= 15<<4<< LeafMethod6() + s_int_26| LeafMethod6())
                    {
                        case 1:
                        {
                            s_s5_43.byte_15 /= (byte)((s_byte_21 += 15+4)/ 15%4* s_s5_43.byte_15* (byte_155 >>= s1_61.int_1 % 15+4)+ 71+ 20);
                            break;
                        }
                        case 0:
                        {
                            break;
                        }
                        case -2:
                        {
                            if (s_bool_20)
                            {
                                if (s_sbyte_28 >= ((sbyte_52 %= (sbyte)(LeafMethod8() | 15+4))^ LeafMethod8() >> s1_174.int_1^ sbyte_52 >> LeafMethod6()))
                                {
                                    s5_183.byte_15 <<= s4_65.s1_14.int_1 * (s1_61.int_1 + (s_s1_37.int_1 = LeafMethod6()))* (s_s1_37.int_1 |= -1);
                                    Method2(LeafMethod3() % LeafMethod3() + s1_s1_d1_f3_169.decimal_2+ 69/ LeafMethod3() % LeafMethod3()+ 5- (s_s2_s2_d1_f1_38.s1_s1_d1_f3_6.decimal_2 + LeafMethod3())+ 28, s1_s1_d1_f3_169);
                                }
                                else
                                {
                                }
                                if (long_51 >= (s_long_27 *= s_long_27))
                                {
                                }
                                else
                                {
                                    s_ushort_31 |= ushort_55 ^= s1_61.ushort_0 ^= (ushort)(LeafMethod11() | s1_61.ushort_0& LeafMethod11());
                                    s_s4_41.s1_14.ushort_0 %= (ushort)(ushort_165 + s4_65.s1_14.ushort_0+ 74);
                                }
                            }
                            else
                            {
                                s_uint_32 |= uint_56 = LeafMethod12()+ (uint_56 ^= s_uint_32);
                            }
                            break;
                        }
                        default:
                        {
                            switch (s_long_27 += s_long_27 + LeafMethod7() ^ LeafMethod7()% 15+4)
                            {
                                case 1:
                                {
                                    Method2(s3_64.s2_12.s1_s1_d1_f3_8.decimal_2 + LeafMethod3()% LeafMethod3() / s2_s2_d1_f1_175.s1_s1_d1_f3_6.decimal_2+ 79+ 48* LeafMethod3() + LeafMethod3()+ s1_s1_d1_f4_s1_d2_f3_59.s1_s1_d1_f3_5.decimal_2 / (s1_s1_d1_f3_168.decimal_2+ 41), s1_s1_d1_f3_168);
                                    break;
                                }
                                case -5:
                                {
                                    switch (15+4^ s_long_27)
                                    {
                                        case 1:
                                        {
                                            break;
                                        }
                                        case -1:
                                        {
                                            sbyte_52 &= (sbyte)(sbyte_162 * LeafMethod8()% 15+4- s_sbyte_28 * LeafMethod8()* LeafMethod8()>> 15^4);
                                            s1_s1_d1_f3_168.decimal_2 = s_s5_s5_d1_f3_42.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 % (s3_178.s2_12.s1_s1_d1_f3_8.decimal_2 = LeafMethod3())+ 91- (s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 = s1_s1_d1_f4_s1_d2_f3_59.s1_s1_d1_f3_5.decimal_2 += s3_64.s2_12.s1_s1_d1_f3_8.decimal_2)% 4.0952380952380952380952380952m - -2147483647m % s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2+ 86+ 50;
                                            break;
                                        }
                                        case 0:
                                        {
                                            s1_s1_d1_f4_60.ulong_3 |= s_s3_40.ulong_10 -= s_s5_s5_d1_f3_42.s1_s1_d1_f4_19.ulong_3;
                                            s5_67.byte_15 %= (byte)(byte_45 - (s_s5_43.byte_15 | (s5_67.byte_15 %= 15+4))+ 5);
                                            break;
                                        }
                                        default:
                                        {
                                            s_long_27 <<= s4_180.int_13 /= 15>>4<< s_s4_41.s1_14.int_1+ s3_178.int_11 | LeafMethod6()/ (s3_178.int_11 * s_s1_37.int_1/ (s4_65.int_13 = s4_180.s1_14.int_1)+ 62)+ 61;
                                            break;
                                        }
                                    }
                                    s1_s1_d1_f4_60.float_4 %= s_s3_40.s2_12.float_9 /= s_s2_39.float_9 += 15+4;
                                    long_51 *= long_161 + (long_51 <<= 15>>4)+ (LeafMethod7() << LeafMethod6())% (s_long_27 << LeafMethod6())+ 66;
                                    LeafMethod22();
                                    break;
                                }
                                case 0:
                                {
                                    long_161 >>= s_s3_40.int_11 = s_s1_37.int_1 + LeafMethod6() + s1_173.int_1- LeafMethod6() + LeafMethod6();
                                    LeafMethod15();
                                    switch ((LeafMethod7() >> (s_s1_37.int_1 = int_50 << s3_64.int_11))+ (long_51 ^= long_51 >>= LeafMethod6())>> 15/4)
                                    {
                                        case -1:
                                        {
                                            short_159 |= (short)(LeafMethod5() & (short_49 |= LeafMethod5()));
                                            short_49 /= (short)(LeafMethod5()+ 97);
                                            s3_64.ulong_10 >>= s_s1_37.int_1 += int_50% (s_int_26 = s4_65.int_13 - s1_61.int_1+ LeafMethod6() << s3_64.int_11)+ 42;
                                            break;
                                        }
                                        case 0:
                                        {
                                            uint_56 >>= s4_180.s1_14.int_1 << LeafMethod6()% (s_s3_40.int_11 -= s1_173.int_1)+ 51^ s4_65.int_13 - LeafMethod6()* s_s3_40.int_11& (s_s1_37.int_1 &= int_50 &= s1_174.int_1 %= 15+4);
                                            s_s3_40.s2_12.ulong_7 /= 15+4;
                                            s5_s5_d1_f3_181.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 /= s_s1_s1_d1_f4_s1_d2_f3_35.s1_s1_d1_f3_5.decimal_2 *= LeafMethod3() % 15-4* (s_s2_39.s1_s1_d1_f3_8.decimal_2 = s2_s2_d1_f1_62.s1_s1_d1_f3_6.decimal_2)+ 35+ 26;
                                            s_s2_39.float_9 -= float_163;
                                            break;
                                        }
                                        default:
                                        {
                                            s_short_25 -= short_159 >>= s4_65.s1_14.int_1 = 15&4^ s_s1_37.int_1 + s4_180.s1_14.int_1;
                                            s2_63.ulong_7 *= s3_64.ulong_10 * s3_179.ulong_10 + s2_176.ulong_7+ LeafMethod13()- 1;
                                            break;
                                        }
                                    }
                                    LeafMethod3();
                                    uint_166 ^= (s_uint_32 <<= LeafMethod6() % 15+4)* s_uint_32 * 15+15%4+ 43;
                                    LeafMethod22();
                                    LeafMethod3();
                                    break;
                                }
                                default:
                                {
                                    LeafMethod3();
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    if (LeafMethod3() * LeafMethod3() + LeafMethod3()- s3_64.s2_12.s1_s1_d1_f3_8.decimal_2 + LeafMethod3()- LeafMethod3()> (s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 *= LeafMethod3())% decimal_47+ 27- (s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 -= s2_176.s1_s1_d1_f3_8.decimal_2)/ LeafMethod3() + s2_63.s1_s1_d1_f3_8.decimal_2+ 68)
                    {
                    }
                    else
                    {
                        s2_s2_d1_f1_62.s1_s1_d1_f3_6.decimal_2 -= s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 /= LeafMethod3()+ 5* (decimal_47 += s2_177.s1_s1_d1_f3_8.decimal_2 = s_s3_40.s2_12.s1_s1_d1_f3_8.decimal_2 *= LeafMethod3());
                    }
                }
                else
                {
                }
                long_161 |= (LeafMethod7() - s_long_27/ (long_161 += long_51)+ 81>> (s4_65.s1_14.int_1 %= s_s3_40.int_11 + LeafMethod6()+ 94))* s_long_27 << LeafMethod6() ^ int_50<< int_160 / LeafMethod6()+ 75/ LeafMethod6()+ 83;
            }
            s4_65.int_13 = Method1(ref s1_s1_d1_f3_58, s_s2_s2_d1_f1_38, out s2_s2_d1_f1_62, s1_s1_d1_f4_172, out s_s1_s1_d1_f4_s1_d2_f3_35, s_s5_43);
            s1_s1_d1_f3_169 = Method2(LeafMethod3() - s2_63.s1_s1_d1_f3_8.decimal_2+ LeafMethod3()* (s2_63.s1_s1_d1_f3_8.decimal_2 += LeafMethod3() + s3_64.s2_12.s1_s1_d1_f3_8.decimal_2), s1_s1_d1_f3_58);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
}
/*
Got output diff:
--------- Baseline ---------  

Environment:



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

Environment:

set COMPlus_TieredCompilation=0
set COMPlus_JitDoRedundantBranchOpts=0
set COMPlus_EnableHWIntrinsic=0
set COMPlus_AltJitName=clrjit_unix_x64_x64.dll
set COMPlus_AltJit=Method0

Assert failure(PID 61576 [0x0000f088], Thread: 41552 [0xa250]): Assertion failed 'fldSeqForStaticVar->GetTail() == zeroOffsetFldSeq' in 'TestClass:Method0():this' during 'Do value numbering' (IL size 3737)
    File: D:\git\dotnet-runtime\src\coreclr\jit\valuenum.cpp Line: 8207
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Feb 3, 2022
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@kunalspathak kunalspathak added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI and removed untriaged New issue has not been triaged by the area owner labels Feb 3, 2022
@ghost
Copy link

ghost commented Feb 3, 2022

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

Issue Details
// Found by Antigen
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S1
    {
        public struct S1_D1_F3
        {
            public decimal decimal_2;
        }
        public struct S1_D1_F4
        {
            public struct S1_D2_F3
            {
                public S1.S1_D1_F3 s1_s1_d1_f3_5;
            }
            public ulong ulong_3;
            public float float_4;
        }
        public ushort ushort_0;
        public int int_1;
    }
    public struct S2
    {
        public struct S2_D1_F1
        {
            public S1.S1_D1_F3 s1_s1_d1_f3_6;
        }
        public ulong ulong_7;
        public S1.S1_D1_F3 s1_s1_d1_f3_8;
        public float float_9;
    }
    public struct S3
    {
        public ulong ulong_10;
        public int int_11;
        public S2 s2_12;
    }
    public struct S4
    {
        public int int_13;
        public S1 s1_14;
    }
    public struct S5
    {
        public struct S5_D1_F3
        {
            public S1.S1_D1_F4.S1_D2_F3 s1_s1_d1_f4_s1_d2_f3_18;
            public S1.S1_D1_F4 s1_s1_d1_f4_19;
        }
        public byte byte_15;
    }
    static bool s_bool_20 = false;
    static byte s_byte_21 = 1;
    static decimal s_decimal_23 = 2.0857142857142857142857142857m;
    static short s_short_25 = 0;
    static int s_int_26 = 4;
    static long s_long_27 = 4;
    static sbyte s_sbyte_28 = 2;
    static ushort s_ushort_31 = 1;
    static uint s_uint_32 = 63;
    static S1.S1_D1_F3 s_s1_s1_d1_f3_34 = new S1.S1_D1_F3();
    static S1.S1_D1_F4.S1_D2_F3 s_s1_s1_d1_f4_s1_d2_f3_35 = new S1.S1_D1_F4.S1_D2_F3();
    static S1 s_s1_37 = new S1();
    static S2.S2_D1_F1 s_s2_s2_d1_f1_38 = new S2.S2_D1_F1();
    static S2 s_s2_39 = new S2();
    static S3 s_s3_40 = new S3();
    static S4 s_s4_41 = new S4();
    static S5.S5_D1_F3 s_s5_s5_d1_f3_42 = new S5.S5_D1_F3();
    static S5 s_s5_43 = new S5();
    byte byte_45 = 1;
    decimal decimal_47 = 4m;
    short short_49 = 1;
    int int_50 = 4;
    long long_51 = -1;
    sbyte sbyte_52 = 5;
    ushort ushort_55 = 0;
    uint uint_56 = 1;
    S1.S1_D1_F3 s1_s1_d1_f3_58 = new S1.S1_D1_F3();
    S1.S1_D1_F4.S1_D2_F3 s1_s1_d1_f4_s1_d2_f3_59 = new S1.S1_D1_F4.S1_D2_F3();
    S1.S1_D1_F4 s1_s1_d1_f4_60 = new S1.S1_D1_F4();
    S1 s1_61 = new S1();
    S2.S2_D1_F1 s2_s2_d1_f1_62 = new S2.S2_D1_F1();
    S2 s2_63 = new S2();
    S3 s3_64 = new S3();
    S4 s4_65 = new S4();
    S5.S5_D1_F3 s5_s5_d1_f3_66 = new S5.S5_D1_F3();
    S5 s5_67 = new S5();
    [MethodImpl(MethodImplOptions.NoInlining)]
    public decimal LeafMethod3()
    {
        unchecked
        {
            return s_decimal_23 /= 15+4;
        }
    }
    public short LeafMethod5()
    {
        unchecked
        {
            return short_49 |= 15|4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public int LeafMethod6()
    {
        unchecked
        {
            return s_s1_37.int_1 += 15|4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public long LeafMethod7()
    {
        unchecked
        {
            return long_51;
        }
    }
    public sbyte LeafMethod8()
    {
        unchecked
        {
            return (sbyte)(15<<4);
        }
    }
    public ushort LeafMethod11()
    {
        unchecked
        {
            return 15|4;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public uint LeafMethod12()
    {
        unchecked
        {
            return uint_56 <<= s4_65.int_13 = 15+4;
        }
    }
    public ulong LeafMethod13()
    {
        unchecked
        {
            return s_s3_40.s2_12.ulong_7 |= 15&4;
        }
    }
    public S1.S1_D1_F4.S1_D2_F3 LeafMethod15()
    {
        unchecked
        {
            return s_s1_s1_d1_f4_s1_d2_f3_35;
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public S5.S5_D1_F3 LeafMethod22()
    {
        unchecked
        {
            return s5_s5_d1_f3_66;
        }
    }
    public int Method1(ref S1.S1_D1_F3 p_s1_s1_d1_f3_68, S2.S2_D1_F1 p_s2_s2_d1_f1_69, out S2.S2_D1_F1 p_s2_s2_d1_f1_70, S1.S1_D1_F4 p_s1_s1_d1_f4_71, out S1.S1_D1_F4.S1_D2_F3 p_s1_s1_d1_f4_s1_d2_f3_72, S5 p_s5_73)
    {
        unchecked
        {
            S2.S2_D1_F1 s2_s2_d1_f1_95 = new S2.S2_D1_F1();
            S2.S2_D1_F1 s2_s2_d1_f1_96 = s2_s2_d1_f1_95;
            p_s2_s2_d1_f1_70 = s2_s2_d1_f1_96;
            p_s1_s1_d1_f4_s1_d2_f3_72 = s_s1_s1_d1_f4_s1_d2_f3_35;
            return s3_64.int_11;
        }
    }
    public S1.S1_D1_F3 Method2(decimal p_decimal_105, S1.S1_D1_F3 p_s1_s1_d1_f3_106)
    {
        unchecked
        {
            S1.S1_D1_F3 s1_s1_d1_f3_121 = new S1.S1_D1_F3();
            S1.S1_D1_F3 s1_s1_d1_f3_122 = s1_s1_d1_f3_121;
            return s1_s1_d1_f3_122;
        }
    }
    public void Method0()
    {
        unchecked
        {
            byte byte_155 = 63;
            short short_159 = 1;
            int int_160 = 1;
            long long_161 = 63;
            sbyte sbyte_162 = 63;
            float float_163 = -0.78947365f;
            ushort ushort_165 = 4;
            uint uint_166 = 1;
            S1.S1_D1_F3 s1_s1_d1_f3_168 = new S1.S1_D1_F3();
            S1.S1_D1_F3 s1_s1_d1_f3_169 = s1_s1_d1_f3_168;
            S1.S1_D1_F4.S1_D2_F3 s1_s1_d1_f4_s1_d2_f3_170 = new S1.S1_D1_F4.S1_D2_F3();
            S1.S1_D1_F4.S1_D2_F3 s1_s1_d1_f4_s1_d2_f3_171 = s1_s1_d1_f4_s1_d2_f3_170;
            S1.S1_D1_F4 s1_s1_d1_f4_172 = new S1.S1_D1_F4();
            S1 s1_173 = new S1();
            S1 s1_174 = s1_173;
            S2.S2_D1_F1 s2_s2_d1_f1_175 = new S2.S2_D1_F1();
            S2 s2_176 = new S2();
            S2 s2_177 = s2_176;
            S3 s3_178 = new S3();
            S3 s3_179 = s3_178;
            S4 s4_180 = new S4();
            S5.S5_D1_F3 s5_s5_d1_f3_181 = new S5.S5_D1_F3();
            S5 s5_182 = new S5();
            S5 s5_183 = s5_182;
            if (15*4!= 15/4+ s3_64.s2_12.float_9)
            {
            }
            else
            {
                if ((s3_64.s2_12.s1_s1_d1_f3_8.decimal_2 = LeafMethod3())+ LeafMethod3() - LeafMethod3()+ 63.075m + s_s5_s5_d1_f3_42.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2- s_s5_s5_d1_f3_42.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2<= (s_s1_s1_d1_f3_34.decimal_2 += s1_s1_d1_f3_58.decimal_2)/ (s2_63.s1_s1_d1_f3_8.decimal_2 / LeafMethod3()+ 19+ 92)% (s_s5_s5_d1_f3_42.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 + s_s1_s1_d1_f4_s1_d2_f3_35.s1_s1_d1_f3_5.decimal_2)* LeafMethod3()+ 1)
                {
                    switch (s4_65.int_13 ^= 15<<4<< LeafMethod6() + s_int_26| LeafMethod6())
                    {
                        case 1:
                        {
                            s_s5_43.byte_15 /= (byte)((s_byte_21 += 15+4)/ 15%4* s_s5_43.byte_15* (byte_155 >>= s1_61.int_1 % 15+4)+ 71+ 20);
                            break;
                        }
                        case 0:
                        {
                            break;
                        }
                        case -2:
                        {
                            if (s_bool_20)
                            {
                                if (s_sbyte_28 >= ((sbyte_52 %= (sbyte)(LeafMethod8() | 15+4))^ LeafMethod8() >> s1_174.int_1^ sbyte_52 >> LeafMethod6()))
                                {
                                    s5_183.byte_15 <<= s4_65.s1_14.int_1 * (s1_61.int_1 + (s_s1_37.int_1 = LeafMethod6()))* (s_s1_37.int_1 |= -1);
                                    Method2(LeafMethod3() % LeafMethod3() + s1_s1_d1_f3_169.decimal_2+ 69/ LeafMethod3() % LeafMethod3()+ 5- (s_s2_s2_d1_f1_38.s1_s1_d1_f3_6.decimal_2 + LeafMethod3())+ 28, s1_s1_d1_f3_169);
                                }
                                else
                                {
                                }
                                if (long_51 >= (s_long_27 *= s_long_27))
                                {
                                }
                                else
                                {
                                    s_ushort_31 |= ushort_55 ^= s1_61.ushort_0 ^= (ushort)(LeafMethod11() | s1_61.ushort_0& LeafMethod11());
                                    s_s4_41.s1_14.ushort_0 %= (ushort)(ushort_165 + s4_65.s1_14.ushort_0+ 74);
                                }
                            }
                            else
                            {
                                s_uint_32 |= uint_56 = LeafMethod12()+ (uint_56 ^= s_uint_32);
                            }
                            break;
                        }
                        default:
                        {
                            switch (s_long_27 += s_long_27 + LeafMethod7() ^ LeafMethod7()% 15+4)
                            {
                                case 1:
                                {
                                    Method2(s3_64.s2_12.s1_s1_d1_f3_8.decimal_2 + LeafMethod3()% LeafMethod3() / s2_s2_d1_f1_175.s1_s1_d1_f3_6.decimal_2+ 79+ 48* LeafMethod3() + LeafMethod3()+ s1_s1_d1_f4_s1_d2_f3_59.s1_s1_d1_f3_5.decimal_2 / (s1_s1_d1_f3_168.decimal_2+ 41), s1_s1_d1_f3_168);
                                    break;
                                }
                                case -5:
                                {
                                    switch (15+4^ s_long_27)
                                    {
                                        case 1:
                                        {
                                            break;
                                        }
                                        case -1:
                                        {
                                            sbyte_52 &= (sbyte)(sbyte_162 * LeafMethod8()% 15+4- s_sbyte_28 * LeafMethod8()* LeafMethod8()>> 15^4);
                                            s1_s1_d1_f3_168.decimal_2 = s_s5_s5_d1_f3_42.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 % (s3_178.s2_12.s1_s1_d1_f3_8.decimal_2 = LeafMethod3())+ 91- (s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 = s1_s1_d1_f4_s1_d2_f3_59.s1_s1_d1_f3_5.decimal_2 += s3_64.s2_12.s1_s1_d1_f3_8.decimal_2)% 4.0952380952380952380952380952m - -2147483647m % s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2+ 86+ 50;
                                            break;
                                        }
                                        case 0:
                                        {
                                            s1_s1_d1_f4_60.ulong_3 |= s_s3_40.ulong_10 -= s_s5_s5_d1_f3_42.s1_s1_d1_f4_19.ulong_3;
                                            s5_67.byte_15 %= (byte)(byte_45 - (s_s5_43.byte_15 | (s5_67.byte_15 %= 15+4))+ 5);
                                            break;
                                        }
                                        default:
                                        {
                                            s_long_27 <<= s4_180.int_13 /= 15>>4<< s_s4_41.s1_14.int_1+ s3_178.int_11 | LeafMethod6()/ (s3_178.int_11 * s_s1_37.int_1/ (s4_65.int_13 = s4_180.s1_14.int_1)+ 62)+ 61;
                                            break;
                                        }
                                    }
                                    s1_s1_d1_f4_60.float_4 %= s_s3_40.s2_12.float_9 /= s_s2_39.float_9 += 15+4;
                                    long_51 *= long_161 + (long_51 <<= 15>>4)+ (LeafMethod7() << LeafMethod6())% (s_long_27 << LeafMethod6())+ 66;
                                    LeafMethod22();
                                    break;
                                }
                                case 0:
                                {
                                    long_161 >>= s_s3_40.int_11 = s_s1_37.int_1 + LeafMethod6() + s1_173.int_1- LeafMethod6() + LeafMethod6();
                                    LeafMethod15();
                                    switch ((LeafMethod7() >> (s_s1_37.int_1 = int_50 << s3_64.int_11))+ (long_51 ^= long_51 >>= LeafMethod6())>> 15/4)
                                    {
                                        case -1:
                                        {
                                            short_159 |= (short)(LeafMethod5() & (short_49 |= LeafMethod5()));
                                            short_49 /= (short)(LeafMethod5()+ 97);
                                            s3_64.ulong_10 >>= s_s1_37.int_1 += int_50% (s_int_26 = s4_65.int_13 - s1_61.int_1+ LeafMethod6() << s3_64.int_11)+ 42;
                                            break;
                                        }
                                        case 0:
                                        {
                                            uint_56 >>= s4_180.s1_14.int_1 << LeafMethod6()% (s_s3_40.int_11 -= s1_173.int_1)+ 51^ s4_65.int_13 - LeafMethod6()* s_s3_40.int_11& (s_s1_37.int_1 &= int_50 &= s1_174.int_1 %= 15+4);
                                            s_s3_40.s2_12.ulong_7 /= 15+4;
                                            s5_s5_d1_f3_181.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 /= s_s1_s1_d1_f4_s1_d2_f3_35.s1_s1_d1_f3_5.decimal_2 *= LeafMethod3() % 15-4* (s_s2_39.s1_s1_d1_f3_8.decimal_2 = s2_s2_d1_f1_62.s1_s1_d1_f3_6.decimal_2)+ 35+ 26;
                                            s_s2_39.float_9 -= float_163;
                                            break;
                                        }
                                        default:
                                        {
                                            s_short_25 -= short_159 >>= s4_65.s1_14.int_1 = 15&4^ s_s1_37.int_1 + s4_180.s1_14.int_1;
                                            s2_63.ulong_7 *= s3_64.ulong_10 * s3_179.ulong_10 + s2_176.ulong_7+ LeafMethod13()- 1;
                                            break;
                                        }
                                    }
                                    LeafMethod3();
                                    uint_166 ^= (s_uint_32 <<= LeafMethod6() % 15+4)* s_uint_32 * 15+15%4+ 43;
                                    LeafMethod22();
                                    LeafMethod3();
                                    break;
                                }
                                default:
                                {
                                    LeafMethod3();
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    if (LeafMethod3() * LeafMethod3() + LeafMethod3()- s3_64.s2_12.s1_s1_d1_f3_8.decimal_2 + LeafMethod3()- LeafMethod3()> (s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 *= LeafMethod3())% decimal_47+ 27- (s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 -= s2_176.s1_s1_d1_f3_8.decimal_2)/ LeafMethod3() + s2_63.s1_s1_d1_f3_8.decimal_2+ 68)
                    {
                    }
                    else
                    {
                        s2_s2_d1_f1_62.s1_s1_d1_f3_6.decimal_2 -= s5_s5_d1_f3_66.s1_s1_d1_f4_s1_d2_f3_18.s1_s1_d1_f3_5.decimal_2 /= LeafMethod3()+ 5* (decimal_47 += s2_177.s1_s1_d1_f3_8.decimal_2 = s_s3_40.s2_12.s1_s1_d1_f3_8.decimal_2 *= LeafMethod3());
                    }
                }
                else
                {
                }
                long_161 |= (LeafMethod7() - s_long_27/ (long_161 += long_51)+ 81>> (s4_65.s1_14.int_1 %= s_s3_40.int_11 + LeafMethod6()+ 94))* s_long_27 << LeafMethod6() ^ int_50<< int_160 / LeafMethod6()+ 75/ LeafMethod6()+ 83;
            }
            s4_65.int_13 = Method1(ref s1_s1_d1_f3_58, s_s2_s2_d1_f1_38, out s2_s2_d1_f1_62, s1_s1_d1_f4_172, out s_s1_s1_d1_f4_s1_d2_f3_35, s_s5_43);
            s1_s1_d1_f3_169 = Method2(LeafMethod3() - s2_63.s1_s1_d1_f3_8.decimal_2+ LeafMethod3()* (s2_63.s1_s1_d1_f3_8.decimal_2 += LeafMethod3() + s3_64.s2_12.s1_s1_d1_f3_8.decimal_2), s1_s1_d1_f3_58);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
}
/*
Got output diff:
--------- Baseline ---------  

Environment:



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

Environment:

set COMPlus_TieredCompilation=0
set COMPlus_JitDoRedundantBranchOpts=0
set COMPlus_EnableHWIntrinsic=0
set COMPlus_AltJitName=clrjit_unix_x64_x64.dll
set COMPlus_AltJit=Method0

Assert failure(PID 61576 [0x0000f088], Thread: 41552 [0xa250]): Assertion failed 'fldSeqForStaticVar->GetTail() == zeroOffsetFldSeq' in 'TestClass:Method0():this' during 'Do value numbering' (IL size 3737)
    File: D:\git\dotnet-runtime\src\coreclr\jit\valuenum.cpp Line: 8207
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/
Author: kunalspathak
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@kunalspathak
Copy link
Member Author

@dotnet/jit-contrib

@kunalspathak kunalspathak changed the title Assert failure(PID 61576 [0x0000f088], Thread: 41552 [0xa250]): Assertion failed 'fldSeqForStaticVar->GetTail() == zeroOffsetFldSeq' during 'Do value numbering' Assertion failed 'fldSeqForStaticVar->GetTail() == zeroOffsetFldSeq' during 'Do value numbering' Feb 3, 2022
@kunalspathak kunalspathak added arch-x64 os-linux Linux OS (any supported distro) labels Feb 3, 2022
@SingleAccretion SingleAccretion self-assigned this Feb 4, 2022
@SingleAccretion
Copy link
Contributor

Interesting, cannot think off the top of my head why would the sequence be missing here. Will take a look.

@SingleAccretion
Copy link
Contributor

So, the check in question (that has recently been deleted in #64110), is not correct, as it asserts the zero offset sequence must effectively be a singleton, but that is not necessary. For reference, here are the field sequences for the assert's reproduction:

fldSeqForStaticVar: Fseq[s_s5_s5_d1_f3_42, s1_s1_d1_f4_s1_d2_f3_18, s1_s1_d1_f3_5, decimal_2]
zeroOffsetFldSeq:   Fseq[s1_s1_d1_f3_5, decimal_2]

As one can see, they are perfectly ok, just the zero-offset one has two fields in it (and GetTail() returns [decimal_2]).

I will be closing this issue and adding better checking in #64805 as a follow-up.

@SingleAccretion SingleAccretion removed their assignment Feb 4, 2022
@kunalspathak
Copy link
Member Author

@SingleAccretion - Thanks. Can you make sure that this repro doesn't hit any other assert after your #64805?

@SingleAccretion
Copy link
Contributor

@kunalspathak Yep, I have verified that we're not hitting any other asserts for this reproduction after #64805. We're hitting them elsewhere though, so I am fixing that now.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-x64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-linux Linux OS (any supported distro)
Projects
None yet
Development

No branches or pull requests

2 participants