Skip to content

JIT: assert in CSE optimization #13555

@erozenfeld

Description

@erozenfeld

The following test fails with checked x64 jit:

using System;
using System.Runtime.CompilerServices;

struct S
{
    public Program p;
    public int i;
}

struct T
{
    public S s;
}

class Program
{
    public T t;
    public T t1;

    [MethodImpl(MethodImplOptions.NoInlining)]
    int Test()
    {	
        if (this.t.s.p == this.t1.s.p)
        {
            return 0;
        }
        this.t1.s = this.t.s;
        int result = Helper(this.t.s);
        return result;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static int Helper(S s)
    {
        return s.i;
    }

    static int Main()
    {
        Program p = new Program();
        p.t.s.i = 100;
        p.t.s.p = p;

        return p.Test();
    }
}

The result is this assert:

Assert failure(PID 35752 [0x00008ba8], Thread: 21632 [0x5480]): Assertion failed 'IsCompatibleType(cseLclVarTyp, expTyp)' in 'Program:Test():int:this' (IL size 75)

    File: f:\coreclr9\src\jit\optcse.cpp Line: 2159
    Image: f:\coreclr9\bin\tests\Windows_NT.x64.Checked\Tests\Core_Root\CoreRun.exe

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions