Thread overview
[Issue 2819] New: array.sort segfaults if array length >=0x8F_FFFF
Apr 07, 2009
d-bugmail
Apr 07, 2009
d-bugmail
Apr 07, 2009
d-bugmail
Apr 07, 2009
d-bugmail
Apr 07, 2009
d-bugmail
Apr 07, 2009
d-bugmail
May 25, 2011
Andrej Mitrovic
Jan 28, 2012
Walter Bright
April 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2819

           Summary: array.sort segfaults if array length >=0x8F_FFFF
           Product: D
           Version: 1.042
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: clugdbug@yahoo.com.au


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.


-- 

April 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2819


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
           Keywords|                            |wrong-code




------- Comment #1 from smjg@iname.com  2009-04-07 14:20 -------
(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?


-- 

April 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2819





------- Comment #2 from clugdbug@yahoo.com.au  2009-04-07 14:47 -------
(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.


-- 

April 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2819





------- Comment #3 from andrei@metalanguage.com  2009-04-07 15:05 -------
(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.


-- 

April 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2819





------- Comment #4 from matti.niemenmaa+dbugzilla@iki.fi  2009-04-07 15:17 -------
http://www.dsource.org/projects/tango/ticket/571 has some old numbers.


-- 

April 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2819





------- Comment #5 from smjg@iname.com  2009-04-07 16:19 -------
(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


-- 

May 25, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2819


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-24 22:24:36 PDT ---
I can't recreate this bug on 2.053. If others can confirm, close this down I guess.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2819



--- Comment #8 from github-bugzilla@puremagic.com 2012-01-27 21:08:32 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2819



--- Comment #9 from github-bugzilla@puremagic.com 2012-01-27 21:09:54 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/077c1bd9948dce0a645cc5df5b9dc8919a2295fc Issue 2819 - array.sort segfaults if array length >=0x8F_FFFF

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2819


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


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