digitalmars.D.bugs - [Issue 11576] New: std.algorithm.remove!(SwapStrategy.unstable) overruns array bounds
- d-bugmail puremagic.com (55/55) Nov 21 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11576
- d-bugmail puremagic.com (7/7) Nov 21 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11576
- d-bugmail puremagic.com (10/10) Nov 21 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11576
- d-bugmail puremagic.com (11/11) Nov 22 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11576
- d-bugmail puremagic.com (11/11) Nov 22 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11576
https://d.puremagic.com/issues/show_bug.cgi?id=11576 Summary: std.algorithm.remove!(SwapStrategy.unstable) overruns array bounds Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: hsteoh quickfur.ath.cx CODE: ------- import std.algorithm, std.stdio; void main() { auto arr = [1,2,3,4]; arr = arr.remove!(SwapStrategy.unstable)(1); // OK assert(arr == [1,4,3]); arr = arr.remove!(SwapStrategy.unstable)(1); // OK assert(arr == [1,3]); arr = arr.remove!(SwapStrategy.unstable)(1); // NG assert(arr == [1]); } ------- OUTPUT: ------- core.exception.RangeError std.algorithm(8139): Range violation ---------------- ./test(_d_array_bounds+0x26) [0x43e84e] ./test() [0x438b12] ./test(pure nothrow safe int[] std.algorithm.__T6removeVE3std9algorithm12SwapStrategy0TAiTiZ.remove(int[], int)+0xab) [0x42e11b] ./test(_Dmain+0x154) [0x42dde4] ./test(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll().void __lambda1()+0x18) [0x435b98] ./test(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x435af2] ./test(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x30) [0x435b58] ./test(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x435af2] ./test(_d_run_main+0x1a3) [0x435a73] ./test(main+0x17) [0x433d67] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f17abe1d995] ------- The range violation occurs at the line marked // NG. This bug consistently happens every time you attempt to remove the last element from an array. In earlier versions of Phobos, this bug does not occur. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 21 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11576 P.S. This is on Phobos git HEAD. I haven't checked the latest release to see if it also happens there. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 21 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11576 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull https://github.com/D-Programming-Language/phobos/pull/1710 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 21 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11576 Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/c1ce350db96e135c1a81a702f2f8913a139f13fc Fix issue 11576. https://github.com/D-Programming-Language/phobos/commit/b6add96a2ba1a37ae231ad5ead01411bed7e9c97 Fix issue 11576. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11576 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Confirmed fixed in git HEAD. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2013