Skip to content

JIT: invalid flags handling by fgMorphStoreDynBlock #79750

@jakobbotsch

Description

@jakobbotsch

fgMorphStoreDynBlock calls SetIndirExceptionFlags, but that function should not be used for stores.

using System.Runtime.CompilerServices;

class Runtime_12345
{
    static unsafe int Main(string[] args)
    {
        byte dest = 0;
        byte source = 100;
        uint size = GetSize();
        Unsafe.CopyBlock(ref dest, ref GetAddr(ref source), size);

        return dest;
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    private static ref byte GetAddr(ref byte a) => ref a;

    [MethodImpl(MethodImplOptions.NoInlining)]
    private static uint GetSize() => 1;
}
Assert failure(PID 24244 [0x00005eb4], Thread: 18180 [0x4704]): Assertion failed '!"Missing flags on tree"' in 'Runtime_12345:Main(System.String[])' during 'Morph - Global' (IL size 26; hash 0x264ab10b; FullOpts)

    File: C:\dev\dotnet\runtime4\src\coreclr\jit\fgdiagnostic.cpp Line: 3195
    Image: C:\dev\dotnet\runtime4\artifacts\bin\coreclr\windows.x64.Checked\CoreRun.exe

Will extract my fix from #79346 and add the test case.

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

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions