Skip to content

[JitOptRepeat] Assertion failed 'limit->OperGet() == GT_ARR_LENGTH' during 'Optimize Valnum CSEs' #74785

@kunalspathak

Description

@kunalspathak
// Found by Antigen

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S1
    {
        public byte byte_0;
    }
    public struct S2
    {
    }
    static decimal s_decimal_7 = 5.0625m;
    static double s_double_8 = 1;
    static uint s_uint_16 = 5;
    static S1 s_s1_18 = new S1();
    static S2 s_s2_19 = new S2();
    bool bool_20 = true;
    uint uint_32 = 5;
    ulong ulong_33 = 0;
    S1 s1_34 = new S1();
    S2 s2_35 = new S2();
    static int s_loopInvariant = 2;
    public decimal Method9(ref S2 p_s2_262)
    {
        unchecked
        {
            return 15%4;
        }
    }
    public S2 Method34(S1 p_s1_892, ref S2 p_s2_893, ref S2 p_s2_894, ref byte p_byte_895, out S1 p_s1_896, S2 p_s2_897)
    {
        unchecked
        {
            for (int __loopvar2 = 15-4; 15!=4;)
            {
                do
                {
                    for (;;)
                    {
                        s_decimal_7 *= Method9(ref s_s2_19);
                    }
                }
                while (15!=4);
            }
            return s_s2_19;
        }
    }
    public void Method0()
    {
        unchecked
        {
            S2 s2_2627 = new S2();
            s_s2_19 = Method34(s_s1_18, ref s2_2627, ref s2_35, ref s1_34.byte_0, out s_s1_18, s2_35);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
}
/*
Environment:

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

Unhandled exception. 
Assert failure(PID 68200 [0x00010a68], Thread: 13360 [0x3430]): Assertion failed 'limit->OperGet() == GT_ARR_LENGTH' in 'System.Reflection.PortableExecutable.PEHeaders:GetContainingSectionIndex(int):int:this' during 'Optimize Valnum CSEs' (IL size 93; hash 0x7476b29f; FullOpts)
    File: D:\git\dotnet-runtime\src\coreclr\jit\compiler.hpp Line: 3485
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/

category:correctness
theme:value-numbering
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