WIP: Boundschecks for searchsorted & remove step(r::Range)==0 tests #7078
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.
searchsorted*
methods. At the momentan error like this is possible:
I corrected this by adding a bounds check. The alternative would be to rename the low-level
searchsorted*
to, say,_searchsorted*
and not export them. (my understanding is that no exported methods in Base should seg-fault unless they are labeledunsafe_
)TODO: The same goes for the low-level
select!
andsort!
methods, which also do not check bounds. But some of them are recursive and a bounds check is only necessary on the first execution. Maybe renaming would be better? @StefanKarpinski, I think you updated sort.jl most recently, maybe you can comment. Let me know what would be the preferred solution and I can update this PR.Here an example of a
sort!
bug:step(r)==0
tests as ranges cannot have 0 steps (I think)