Skip to content

Assertion failure while crossgenning ImageSharp: '!op1->TypeIs(TYP_STRUCT) && (op1->TypeGet() == op2->TypeGet())' in 'SixLabors.ImageSharp.PixelFormats.Byte4:ToString():System.String:this' during 'Morph - Global' #70824

@jakobbotsch

Description

@jakobbotsch

When crossgenning ImageSharp on current main I hit the following assertion:

C:\dev\dotnet\runtime2\src\coreclr\jit\simd.cpp:1646
Assertion failed '!op1->TypeIs(TYP_STRUCT) && (op1->TypeGet() == op2->TypeGet())' in 'SixLabors.ImageSharp.PixelFormats.Byte4:ToString():System.String:this' during 'Morph - Global' (IL size 85; hash 0xaeeb505c; FullOpts)

Small x64 repro (does not require crossgen, requires opts enabled/TC disabled):

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

public class Program
{
    public static void Main(string[] args)
    {
        Byte4 foo = default;
        Console.WriteLine(foo.ToString());
    }
}

public partial struct Byte4
{
    public uint PackedValue { get; set; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public readonly Vector4 ToVector4() => new(
            this.PackedValue & 0xFF,
            (this.PackedValue >> 0x8) & 0xFF,
            (this.PackedValue >> 0x10) & 0xFF,
            (this.PackedValue >> 0x18) & 0xFF);

    public override readonly string ToString()
    {
        var vector = this.ToVector4();
        return FormattableString.Invariant($"Byte4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})");
    }
}

Metadata

Metadata

Labels

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

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions