Skip to content

Assertion failed 'node->OperIs(GT_ADD, GT_SUB)' in 'Matrix:GetHashCode():int:this' during 'Lowering nodeinfo' (IL size 96) #61629

@MichalStrehovsky

Description

@MichalStrehovsky

NGenDump:
ngendump.txt

Compile the following with optimizations turned on:

using System;
using System.Runtime.InteropServices;

Activator.CreateInstance(typeof(Matrix)).GetHashCode();

[StructLayout(LayoutKind.Sequential)]
public class Matrix : ICloneable
{
    public double Xx;
    public double Yx;
    public double Xy;
    public double Yy;
    public double X0;
    public double Y0;

    public Matrix(double xx, double yx, double xy, double yy,
            double x0, double y0)
    {
        this.Xx = xx; this.Yx = yx; this.Xy = xy;
        this.Yy = yy; this.X0 = x0; this.Y0 = y0;
    }

    public Matrix()
    {
    }

    public bool IsIdentity()
    {
        return (this == new Matrix());
    }

    public void Init(double xx, double yx, double xy, double yy,
              double x0, double y0)
    {
        this.Xx = xx; this.Yx = yx; this.Xy = xy;
        this.Yy = yy; this.X0 = x0; this.Y0 = y0;
    }

    

    public override String ToString()
    {
        String s = String.Format("xx:{0:##0.0#} yx:{1:##0.0#} xy:{2:##0.0#} yy:{3:##0.0#} x0:{4:##0.0#} y0:{5:##0.0#}",
            this.Xx, this.Yx, this.Xy, this.Yy, this.X0, this.Y0);
        return s;
    }

    public static bool operator ==(Matrix lhs, Matrix rhs)
    {
        return (lhs.Xx == rhs.Xx &&
            lhs.Xy == rhs.Xy &&
            lhs.Yx == rhs.Yx &&
            lhs.Yy == rhs.Yy &&
            lhs.X0 == rhs.X0 &&
            lhs.Y0 == rhs.Y0);
    }

    public static bool operator !=(Matrix lhs, Matrix rhs)
    {
        return !(lhs == rhs);
    }



    public override bool Equals(object o)
    {
        if (!(o is Matrix))
            return false;
        else
            return (this == (Matrix)o);
    }

    public override int GetHashCode()
    {
        return (int)this.Xx ^ (int)this.Xx >> 32 ^
            (int)this.Xy ^ (int)this.Xy >> 32 ^
            (int)this.Yx ^ (int)this.Yx >> 32 ^
            (int)this.Yy ^ (int)this.Yy >> 32 ^
            (int)this.X0 ^ (int)this.X0 >> 32 ^
            (int)this.Y0 ^ (int)this.Y0 >> 32;
    }

    public object Clone()
    {
        return this.MemberwiseClone();
    }

}

Metadata

Metadata

Assignees

No one assigned

    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