-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BoundsError in sort! on ill-behaved user-specified comparisons #11429
Comments
Running with --check-bounds=yes says it's a logic error in the quicksort thing. |
Worth keeping in mind is the |
@malmaud great catch! this was exactly the problem, thanks a lot! it works just fine with What's the best way of helping the user here? Make the docs more explicit? |
I'm not sure it's possible to make the algorithm robust against a comparison that's not a strict total order. We might need a separate function with bounds checks for user-defined orders. |
Of course, you can get the same kind of problem by sorting with |
Shall we just add something to the |
For now I think that's best. Do we have a label for closed issues that should maybe be revisited one day? |
I but back the bug label because the exposed functionality of Julia should not crash like this from erroneous usage. |
If it's a bug, then the fix is not documenting it. |
* Change partitioning scheme to use scratch space * Randomize pivot selection with a hash-based fallback for when `rand` is unavailable * remove an unnecessary sorting operation in typealias construction in base/show.jl * Seed rng before generating precompile statements * Add presorted check to avoid performance regressions * test invalid `lt` to close #11429 & #32675 * test that PartialQuickSort is stable * update radix sort dispatch heuristics because quicksort is now faster and the primary competition Co-authored-by: Petr Vana <[email protected]> Co-authored-by: Oscar Smith <[email protected]>
The following reduced example triggers a
BoundsError
in both 0.3.8 and latest master:The text was updated successfully, but these errors were encountered: