Skip to content

Assertion failed '(arg.GetEarlyNode() == nullptr) != (arg.GetLateNode() == nullptr)' during 'Rationalize IR' #73634

Closed
@kunalspathak

Description

@kunalspathak
// Found by Antigen

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S1
    {
        public ushort ushort_1;
        public sbyte sbyte_2;
    }
    public struct S2
    {
        public long long_4;
    }
    static byte s_byte_6 = 5;
    static char s_char_7 = 'U';
    static decimal s_decimal_8 = 5.0202020202020202020202020202m;
    static double s_double_9 = 2.037974683544304;
    static short s_short_10 = -1;
    static int s_int_11 = -5;
    static long s_long_12 = -2;
    static float s_float_14 = -1.84f;
    static string s_string_15 = "X8V1S0";
    static uint s_uint_17 = 1;
    static ulong s_ulong_18 = 0;
    static S1 s_s1_19 = new S1();
    static S2 s_s2_20 = new S2();
    byte byte_22 = 1;
    char char_23 = 'Q';
    decimal decimal_24 = -1.9444444444444444444444444444m;
    double double_25 = 5;
    int int_27 = -2;
    float float_30 = -0.9722222f;
    uint uint_33 = 40;
    S1 s1_35 = new S1();
    S2 s2_36 = new S2();
    public byte LeafMethod1()
    {
        unchecked
        {
            return 15%4;
        }
    }
    public long LeafMethod7()
    {
        unchecked
        {
            return s2_36.long_4 |= 15+4;
        }
    }
    public sbyte LeafMethod8()
    {
        unchecked
        {
            return (sbyte)(15<<4);
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public S1 LeafMethod14()
    {
        unchecked
        {
            return s1_35;
        }
    }
    public uint Method14(ref S1 p_s1_396, out S1 p_s1_397, S2 p_s2_398, ref S2 p_s2_399, S1 p_s1_400, S1 p_s1_401, out S1 p_s1_402, ref S2 p_s2_403)
    {
        unchecked
        {
            p_s1_397 = s1_35;
            p_s1_402 = p_s1_396;
            return s_uint_17;
        }
    }
    public S1 Method21(ref int p_int_593, ref decimal p_decimal_594, out S2 p_s2_595, ref S2 p_s2_596, sbyte p_sbyte_597, out S2 p_s2_598, S2 p_s2_599, out S2 p_s2_600, S2 p_s2_601, S1 p_s1_602, ref decimal p_decimal_603, ref S2 p_s2_604, ref S2 p_s2_605, out S2 p_s2_606)
    {
        unchecked
        {
            p_s2_595 = s_s2_20;
            p_s2_598 = p_s2_604;
            p_s2_600 = s_s2_20;
            p_s2_606 = s2_36;
            return s1_35;
        }
    }
    public float Method41(out decimal p_decimal_1134, short p_short_1135, out S1 p_s1_1136, ref S1 p_s1_1137, S1 p_s1_1138, ref S1 p_s1_1139, long p_long_1140, ref ulong p_ulong_1141, ref int p_int_1142, out S2 p_s2_1143, S1 p_s1_1144, out S2 p_s2_1145)
    {
        unchecked
        {
            int int_1152 = 0;
            sbyte sbyte_1154 = 40;
            S1 s1_1160 = new S1();
            S1 s1_1161 = s1_1160;
            S2 s2_1162 = new S2();
            p_decimal_1134 = decimal_24;
            p_s1_1136 = s1_35;
            p_s2_1143 = s_s2_20;
            p_s2_1145 = s_s2_20;
            try
            {
                if ((uint_33 -= 15%4)>= Method14(ref s1_35, out s_s1_19, s2_36, ref s_s2_20, s1_35, p_s1_1137, out s1_1161, ref s2_1162))
{}                else
                {
                    switch (15+4+ s_string_15)
                    {
                        case "69T":
                        {
                            s_byte_6 >>= s_int_11 <<= 15>>4;
                            break;
                        }
                        case "S":
                        {
                            break;
                        }
                        default:
                        {
                            break;
                        }
                    }
                }
            }
            catch (System.NullReferenceException)
            {
                if ((15&4)< Method14(ref s1_1161, out s_s1_19, s_s2_20, ref p_s2_1143, p_s1_1138, LeafMethod14(), out s1_35, ref p_s2_1143) + 15/4)
                {
                    switch (char_23 = char_23 = s_char_7)
                    {
                        case '6':
                        {
                            break;
                        }
                        case 'Y':
                        {
                            break;
                        }
                        case 'J':
                        {
                            break;
                        }
                        default:
                        {
                            Method21(ref int_1152, ref decimal_24, out s_s2_20, ref s_s2_20, (sbyte)((s1_1161.sbyte_2 >> s_int_11)* (sbyte_1154 & 5)& LeafMethod8()), out s2_36, s2_36, out s_s2_20, s_s2_20, s1_35, ref s_decimal_8, ref p_s2_1145, ref s2_36, out p_s2_1145);
                            break;
                        }
                    }
                }
                else
                {
                    while (s_decimal_8 == 15%4)
                    {
                    }
                }
            }
            return 15+4;
        }
    }
    public byte Method50(out S1 p_s1_1368, S1 p_s1_1369, out S1 p_s1_1370, S1 p_s1_1371, S2 p_s2_1372, S1 p_s1_1373, out double p_double_1374, out ushort p_ushort_1375, out byte p_byte_1376, S1 p_s1_1377, float p_float_1378, S1 p_s1_1379, ref S2 p_s2_1380, ref S1 p_s1_1381, out ulong p_ulong_1382, S2 p_s2_1383, out byte p_byte_1384, ref S2 p_s2_1385)
    {
        unchecked
        {
            p_s1_1368 = p_s1_1371;
            p_s1_1370 = s1_35;
            p_double_1374 = 15/4;
            p_ushort_1375 = 15-4;
            p_byte_1376 = LeafMethod1();
            p_ulong_1382 = 15+4;
            p_byte_1384 = 15^4;
            return p_byte_1376;
        }
    }
    public sbyte Method97(S1 p_s1_2631, ref double p_double_2632, S2 p_s2_2633, out S2 p_s2_2634, S1 p_s1_2635, S2 p_s2_2636, S1 p_s1_2637, ref S1 p_s1_2638, ref S2 p_s2_2639, decimal p_decimal_2640, out S1 p_s1_2641, out byte p_byte_2642, out float p_float_2643, long p_long_2644, S1 p_s1_2645, ref S1 p_s1_2646, S2 p_s2_2647, ref float p_float_2648, out S1 p_s1_2649)
    {
        unchecked
        {
            S2 s2_2665 = new S2();
            p_s2_2634 = s_s2_20;
            p_s1_2641 = p_s1_2646;
            p_byte_2642 = Method50(out s1_35, s1_35, out s_s1_19, s1_35, s_s2_20, s_s1_19, out s_double_9, out s_s1_19.ushort_1, out byte_22, s1_35, s_float_14 = -1.9866667f, p_s1_2637, ref s2_2665, ref p_s1_2637, out s_ulong_18, s2_36, out byte_22, ref p_s2_2634);
            p_float_2643 = Method41(out p_decimal_2640, s_short_10 -= 15*4, out s1_35, ref s_s1_19, s1_35, ref s_s1_19, s_long_12 = LeafMethod7(), ref s_ulong_18, ref int_27, out s2_36, s1_35, out s2_36);
            p_s1_2649 = s1_35;
            return 15^4;
        }
    }
    public void Method0()
    {
        unchecked
        {
            S1 s1_2728 = new S1();
            s1_2728.sbyte_2 = Method97(s1_35, ref double_25, s_s2_20, out s_s2_20, s_s1_19, s2_36, s_s1_19, ref s1_2728, ref s2_36, decimal_24 = decimal_24, out s_s1_19, out byte_22, out float_30, s2_36.long_4 <<= 15-4, s1_2728, ref s_s1_19, s_s2_20, ref float_30, out s_s1_19);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
}

/*
Environment:

set COMPlus_JitOptRepeat=*
set COMPlus_AltJitName=clrjit_unix_x64_x64.dll
set COMPlus_AltJit=Method41

Assert failure(PID 19548 [0x00004c5c], Thread: 14352 [0x3810]): Assertion failed '(arg.GetEarlyNode() == nullptr) != (arg.GetLateNode() == nullptr)' in 'TestClass:Method41(byref,short,byref,byref,S1,byref,long,byref,byref,byref,S1,byref):float:this' during 'Rationalize IR' (IL size 437; hash 0x6b94ab9e; Tier0-FullOpts)
    File: D:\git\dotnet-runtime\src\coreclr\jit\rationalize.cpp Line: 627
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/


category:correctness
theme:ir
skill-level:intermediate
cost:small
impact:small

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions