Skip to content

wrong multireg copies from reg to small type field in memory  #46240

@sandreenko

Description

@sandreenko

Add a repro for the problem that was pointed in #46176 (comment)

using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Numerics;

public struct S
{
    public object o;
    public byte b;
}

public class UnitTest1
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void TestS(S s)
    {
        return;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static S GetS()
    {
        return new S();
    }



    [MethodImpl(MethodImplOptions.NoInlining)]
    public static int TestS()
    {

        S s1 = GetS();
        S s2 = GetS();
        S s3 = GetS();
        S s4 = GetS();
        S s5 = GetS();
        S s6 = GetS();
        S s7 = GetS();
        S s8 = GetS();
        S s9 = GetS();
        S s10 = GetS();

        TestS(s10);
        TestS(s9);
        TestS(s8);
        TestS(s7);
        TestS(s6);
        TestS(s5);
        TestS(s4);
        TestS(s3);
        TestS(s2);
        TestS(s1);

        return 1;

    }

    public static int Main(string[] args)
    {
        TestS();
        return 100;
    }
}

It has regressed after #46176 + #45625

Fails with

Assert failure(PID 20984 [0x000051f8], Thread: 34716 [0x879c]): Assertion failed 'isValidGeneralDatasize(size)' in 'UnitTest1:TestS():int' during 'Generate code' (IL size 102)

    File: D:\Sergey\git\runtime\src\coreclr\jit\emitarm64.cpp Line: 7689

because we use different size for ins_Store(8 byte in this case) and emitTypeSize(1 byte in this case).

repro steps:

complus_altjit=*
complus_altjitname=clrjit_win_arm64_x64.dll
complus_SIMD16ByteOnly=1
complus_jitdump=UnitTest1:TestS():int
windows.x64.Checked\Tests\Core_Root\CoreRun.exe test.dll

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

Relationships

None yet

Development

No branches or pull requests

Issue actions