[Issue 24221] New: Stable sort crash
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 2 16:32:53 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24221
Issue ID: 24221
Summary: Stable sort crash
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: john.loughran.colvin at gmail.com
Created attachment 1898
--> https://issues.dlang.org/attachment.cgi?id=1898&action=edit
the code to trigger the crash
I know this predicate is weird and almost certainly isn't what the user wanted.
I am reporting the crash & wondering if the predicate is "allowed".
predicate:
(x, y) => x.a < y.a && x.b < y.b;
data type:
Tuple!(string, "a", string, "b")[];
data length:
129
I reduced it from a longer array, but any smaller and the problem stops.
Please find code attached.
Error output:
core.exception.ArrayIndexError@/home/john/dlang/dmd-2.105.2/linux/bin64/../../src/phobos/std/algorithm/sorting.d(2755):
index [18446744073709551615] is out of bounds for array of length 1
----------------
??:? onArrayIndexError [0x55b9bdd1bc26]
??:? _d_arraybounds_indexp [0x55b9bdd1bbe3]
??:? pure @safe ulong
std.algorithm.sorting.TimSortImpl!(crash.main().__lambda1,
immutable(char)[][][]).mergeHi!().mergeHi(immutable(char)[][][],
immutable(ulong), ulong, immutable(char)[][][]) [0x55b9bdcfd051]
??:? pure @safe void std.algorithm.sorting.TimSortImpl!(crash.main().__lambda1,
immutable(char)[][][]).merge!().merge(immutable(char)[][][], ulong, ref ulong,
ref immutable(char)[][][]) [0x55b9bdcfbeb9]
??:? pure @safe void std.algorithm.sorting.TimSortImpl!(crash.main().__lambda1,
immutable(char)[][][]).mergeAt!().mergeAt(immutable(char)[][][],
std.algorithm.sorting.TimSortImpl!(crash.main().__lambda1,
immutable(char)[][][]).Slice[], immutable(ulong), ref ulong, ref
immutable(char)[][][]) [0x55b9bdcfbb24]
??:? pure @safe void std.algorithm.sorting.TimSortImpl!(crash.main().__lambda1,
immutable(char)[][][]).sort!().sort(immutable(char)[][][],
immutable(char)[][][]) [0x55b9bdcfab62]
??:? pure @safe std.range.SortedRange!(immutable(char)[][][],
crash.main().__lambda1, 0).SortedRange
std.algorithm.sorting.sort!(crash.main().__lambda1, 2,
immutable(char)[][][]).sort(immutable(char)[][][]) [0x55b9bdcfa11e]
??:? _Dmain [0x55b9bdcf9f01]
--
More information about the Digitalmars-d-bugs
mailing list