Bug 2819 – array.sort segfaults if array length >=0x8F_FFFF

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2009-04-07T13:17:00Z
Last change time
2014-04-18T09:14:23Z
Keywords
wrong-code
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2009-04-07T13:17:33Z
void main() { auto a = new uint[0x8F_FFFF]; // smallest size that fails a.sort; } It's caused by the hard-coded byte*[40] stack; // stack in extern (C) long _adSort(Array a, TypeInfo ti) in qsort.d. Affects both D1 and D2. This is just another reason for the built-in .sort to be deprecated.
Comment #1 by smjg — 2009-04-07T14:20:12Z
(In reply to comment #0) > This is just another reason for the built-in .sort to be deprecated. I don't understand. How is this bug a consequence of sort being built in?
Comment #2 by clugdbug — 2009-04-07T14:47:23Z
(In reply to comment #1) > (In reply to comment #0) > > This is just another reason for the built-in .sort to be deprecated. > > I don't understand. How is this bug a consequence of sort being built in? It isn't. But the fact that the built-in sort is buggy as well as slow and limited, further weakens its appeal. It just doesn't seem to have much going for it.
Comment #3 by andrei — 2009-04-07T15:05:46Z
(In reply to comment #2) > (In reply to comment #1) > > (In reply to comment #0) > > > This is just another reason for the built-in .sort to be deprecated. > > > > I don't understand. How is this bug a consequence of sort being built in? > > It isn't. But the fact that the built-in sort is buggy as well as slow and > limited, further weakens its appeal. It just doesn't seem to have much going > for it. > I agree. By the way, if anyone has run numbers on the relative speeds of various sort implementations, please share.
Comment #4 by matti.niemenmaa+dbugzilla — 2009-04-07T15:17:15Z
Comment #5 by smjg — 2009-04-07T16:19:53Z
(In reply to comment #3) > I agree. By the way, if anyone has run numbers on the relative speeds of > various sort implementations, please share. What's a run number? Anyway, here's a program I wrote a while ago to benchmark sorting algorithms: http://www.digitalmars.com/d/archives/digitalmars/D/announce/Sorting_algorithms_benchmark_7661.html http://pr.stewartsplace.org.uk/d/sortbench.d
Comment #6 by andrej.mitrovich — 2011-05-24T22:24:36Z
I can't recreate this bug on 2.053. If others can confirm, close this down I guess.
Comment #7 by clugdbug — 2011-05-25T00:54:15Z
Still segfaults on 1.068. And I don't think the underlying bug has actually been fixed on D2, either, even though this test case works now.
Comment #8 by github-bugzilla — 2012-01-27T21:08:32Z
Commit pushed to phobos-1.x at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/12b9cb5db63216c33485681edc83f2f272d869f9 fix Issue 2819 - array.sort segfaults if array length >=0x8F_FFFF
Comment #9 by github-bugzilla — 2012-01-27T21:09:54Z