www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21857] New: TypeInfo_Array.compare can give wrong result when

https://issues.dlang.org/show_bug.cgi?id=21857

          Issue ID: 21857
           Summary: TypeInfo_Array.compare can give wrong result when
                    either array exceeds 2GB
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

Current code:

https://github.com/dlang/druntime/blob/b4209f33e7705a58d101e5ba906bfa5d10799faa/src/object.d#L918-L934

---
    override int compare(in void* p1, in void* p2) const
    {
        void[] a1 = *cast(void[]*)p1;
        void[] a2 = *cast(void[]*)p2;

        // ... 

        return cast(int)a1.length - cast(int)a2.length;
    }
--

--
Apr 23 2021