[Issue 5705] New: Swapping identical tuple causes "overlapping array copy" exception.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 5 09:03:24 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5705

           Summary: Swapping identical tuple causes "overlapping array
                    copy" exception.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-03-05 09:00:26 PST ---
import std.algorithm, std.typecons;
void main() {
    auto t = tuple(1);
    swap(t, t);
}

The above program causes an exception in _d_arraycopy:

object.Exception at src/rt/arraycat.d(40): overlapping array copy
----------------
5   y                                   0x000154c4 _d_arraycopy + 200
6   y                                   0x000026b5 pure nothrow @trusted void
std.algorithm.swap!(std.typecons.Tuple!(int).Tuple).swap(ref
std.typecons.Tuple!(int).Tuple, ref std.typecons.Tuple!(int).Tuple) + 169
7   y                                   0x00001ee9 _Dmain + 33
8   y                                   0x00015edf extern (C) int
rt.dmain2.main(int, char**).void runMain() + 23
9   y                                   0x00015e66 extern (C) int
rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
10  y                                   0x00015f27 extern (C) int
rt.dmain2.main(int, char**).void runAll() + 59
11  y                                   0x00015e66 extern (C) int
rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 38
12  y                                   0x00015df7 main + 179
13  y                                   0x00001ebd start + 53
14  ???                                 0x00000001 0x0 + 1

It should do nothing instead of throwing this exception. As a result of this
bug, it is impossible to sort() on an array of tuples.

This bug is absent at least since 2.042 and present on or before 2.052.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list