Bug 3638 – stable sort assertion failure for repeated key sequence

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-12-21T13:40:00Z
Last change time
2014-02-14T20:35:53Z
Assigned to
nobody
Creator
andrew.talbot

Comments

Comment #0 by andrew.talbot — 2009-12-21T13:40:32Z
Performing a stable sort on a repeated pair of keys that are already in sorted order causes the following error message. [email protected](3736): Assertion failure However, doing so with repeated reverse-sorted keys works fine. In other words, a stable sort of the array [ "B", "A", "B", A" ] will succeed, but one of ["A", "B", "A", "B" ] will fail. Illustrative code: import std.algorithm; import std.stdio; void main() { auto ar1 = [ "B", "A", "B", "A" ]; sort!("a < b", SwapStrategy.stable)(ar1); // ok writeln(ar1); auto ar2 = [ "A", "B", "A", "B" ]; sort!("a < b", SwapStrategy.stable)(ar2); // fails writeln(ar2); }
Comment #1 by andrei — 2009-12-21T14:23:34Z
Thanks for the report.
Comment #2 by andrew.talbot — 2011-07-16T07:59:37Z
Fixed in version dmd 2.054.