Repository navigation
Conversation
Avoid returned range views when splitting quicksort partitions on affected DMD releases. Construct the tail directly and shorten the head in place, preserving the original slicing path on other compilers. Strengthen struct-sorting coverage with an independent reference and checks for ordering and record preservation around quicksort thresholds. AI-Assisted-By: Codex (GPT-6 Astra Medium)
jmh530
force-pushed
the
codex/dmd-sorting-inlining
branch
from
November 2, 2026 02:57
a901cdc to
d1eb1cc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #501.
Sorting arrays of structs can trigger a bounds assertion when compiled with DMD 2.105–2.112 and optimization/inlining. Construct quicksort’s tail partition directly and shorten the head in place on those releases, avoiding the returned range views that trigger the failure. Other compilers retain the existing implementation.
The reproducer starts passing at dlang/dmd#22189, released in DMD 2.113. The workaround is therefore restricted to
DigitalMarswith2105 <= __VERSION__ < 2113. It preserves the sorting algorithm, comparator behavior, public API, and allocation behavior.Strengthen the existing struct regression with an independently sorted reference. Add ascending and descending tests around quicksort’s size thresholds, checking ordering and preservation of every record and its payload.
Validation
No 32-bit runtime testing, full-package test run, or performance benchmarking was performed.
AI-Assisted-By: Codex (GPT-6 Astra Medium)