Skip to content
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

quickSort, along with Ordering[K], may result in stackoverflow because the code uses '==' instead of 'equiv'. #7837

Closed
scabug opened this issue Sep 12, 2013 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Sep 12, 2013

The following commands will confirm the failing cases.

val indices = (0 to 99999).toArray
val values = Array.fillDouble(math.random)
scala.util.Sorting.quickSortInt(Ordering.byInt, Double) // Works
val values2 = Array.fillDouble(0.0)
scala.util.Sorting.quickSortInt(Ordering.byInt, Double) // Fails

In Sorting.scala's code if I change lines 144 and 151 to use equiv, instead of ==, then the problem seems to be resolved.

@scabug
Copy link
Author

@scabug scabug commented Sep 12, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7837?orig=1
Reporter: Sung Hwan Chung (codedeft)
Affected Versions: 2.10.2

@scabug
Copy link
Author

@scabug scabug commented Dec 23, 2013

@Ichoran said:
Yup, looks like that does it. It's a bit of a trap that everything except == works as expected with an Ordering import. Thanks!

@scabug scabug closed this Jan 8, 2014
@scabug scabug added this to the 2.11.0-M8 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants