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

Potential Large Vector Bug & Some Redundant Array Allocations #9407

Closed
scabug opened this issue Jul 18, 2015 · 3 comments
Closed

Potential Large Vector Bug & Some Redundant Array Allocations #9407

scabug opened this issue Jul 18, 2015 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Jul 18, 2015

Hello Everyone,

while casually looking at the rather complex code of the scala.collection.immutable.Vector implementation I found some odd lines of code and one that I believe to be a bug:

in line 1196 it looks like the newIndex is supposed to be shifted by >>25 but is actually shifted by 20.

I have tried to reproduce a bug in Scala code but failed to do so. From what I understand one has to append or prepend something to a position that is more than 1<<25 positions away from the last written position. But the appendFront and appendBack methods are rather complex and stateful to the extend that I can't figure out which other conditions need to be met.

While I am at it:
There also seem to be completely redundant Array allocations in there, which are probably optimized away by the compiler's (escape analysis?), but they are redundant none the less... right?:

L1159-L1160
L1174-L1175
L1190-L1193

@scabug
Copy link
Author

scabug commented Jul 18, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9407?orig=1
Reporter: Dirk Toewe (dt)
Affected Versions: 2.11.7

@scabug
Copy link
Author

scabug commented Aug 29, 2015

@Ichoran said:
scala/scala#4714

@scabug scabug closed this as completed Sep 8, 2015
@scabug
Copy link
Author

scabug commented Sep 8, 2015

@SethTisue said:
Dirk: thank you! great catch!

@scabug scabug added the has PR label Apr 7, 2017
@scabug scabug added this to the 2.11.8 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants