digitalmars.D.bugs - [Issue 5705] New: Swapping identical tuple causes "overlapping array copy" exception.
- d-bugmail puremagic.com (44/44) Mar 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
- d-bugmail puremagic.com (10/10) Mar 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
- d-bugmail puremagic.com (19/19) Mar 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
- d-bugmail puremagic.com (10/10) Mar 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
- d-bugmail puremagic.com (27/27) Apr 18 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
- d-bugmail puremagic.com (11/11) Apr 18 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
- d-bugmail puremagic.com (6/6) Jun 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
- d-bugmail puremagic.com (10/10) Jun 18 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
- d-bugmail puremagic.com (12/12) Jun 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5705
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 puremagic.com ReportedBy: kennytm gmail.com --- Comment #0 from kennytm 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 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: -------
Mar 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5705 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5705 --- Comment #1 from kennytm gmail.com 2011-03-05 10:15:59 PST --- This could probably be fixed/worked-around in druntime. diff --git a/src/rt/arraycat.d b/src/rt/arraycat.d index c0aaa4d..e9c2c85 100644 --- a/src/rt/arraycat.d +++ b/src/rt/arraycat.d -35,7 +35,7 byte[] _d_arraycopy(size_t size, byte[] from, byte[] to) { memcpy(to.ptr, from.ptr, to.length * size); } - else + else if (to.ptr != from.ptr) { throw new Exception("overlapping array copy"); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5705 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc --- Comment #2 from kennytm gmail.com 2011-03-08 04:22:42 PST --- *** Issue 5716 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5705 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Swapping identical tuple |Swapping identical struct |causes "overlapping array |with hasElaborateAssign |copy" exception. |causes "overlapping array | |copy" exception. --- Comment #3 from kennytm gmail.com 2011-04-18 12:41:34 PDT --- The the reason is Tuple has an opAssign. The same reason goes for SysTime (issue 5853). Generalized test case: ------------------------------- import std.algorithm : swap; struct X { int x; void opAssign(X z) { x = z.x; } } void main() { X y; swap(y, y); } ------------------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 18 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5705 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Jesse.K.Phillips+D gmail.co | |m --- Comment #4 from kennytm gmail.com 2011-04-18 12:45:36 PDT --- *** Issue 5853 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 18 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5705 --- Comment #5 from kennytm gmail.com 2011-06-02 15:40:53 PDT --- *** Issue 6093 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5705 dawg dawgfoto.de changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |soarowl yeah.net --- Comment #6 from dawg dawgfoto.de 2011-06-18 20:07:45 PDT --- *** Issue 4789 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 18 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5705 dawg dawgfoto.de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED CC| |dawg dawgfoto.de Resolution| |FIXED --- Comment #7 from dawg dawgfoto.de 2011-06-19 11:49:10 PDT --- https://github.com/D-Programming-Language/phobos/commit/b776f8b5d22a5894467a31c6b7c6192147a2e649 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 19 2011