www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23911] New: "Overlapping arrays in copy:" error message gone

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

          Issue ID: 23911
           Summary: "Overlapping arrays in copy:" error message gone
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

////////// bug.d /////////
void main()
{
    auto c = new char[10];
    c[0..6] = c[4 .. 10];
}
//////////////////////////

This program used to produce a more useful error message. With 2.080:

object.Error (0): Overlapping arrays in copy: 2 byte(s) overlap of 6
----------------
??:? nothrow  safe void rt.util.array._enforceNoOverlap(const(char[]), ulong,
ulong, const(ulong)) [0xd88da756]
??:? _d_arraycopy [0xd88d87ba]
??:? _Dmain [0xd88d8699]

However, this is gone in 2.084 or later. Current versions just produce a
nondescript "Range violation", which isn't even accurate, as all the indices
are in-range.

Even though one would expect the test to be in Druntime, bisection shows this
to be a DMD regression. Introduced in https://github.com/dlang/dmd/pull/7867

--
May 10 2023