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

v = []; push!(v, length(v)) produces [1] #14245

Closed
xitology opened this issue Dec 3, 2015 · 5 comments · Fixed by #14754
Closed

v = []; push!(v, length(v)) produces [1] #14245

xitology opened this issue Dec 3, 2015 · 5 comments · Fixed by #14754
Labels
bug Indicates an unexpected problem or unintended behavior regression Regression in behavior compared to a previous version

Comments

@xitology
Copy link
Contributor

xitology commented Dec 3, 2015

$ julia -E 'f() = (v = []; push!(v, length(v)); v); f()'
Any[1]

However, if you disable inlining, you get the correct result.

$ julia --inline=no -E 'f() = (v = []; push!(v, length(v)); v); f()'
Any[0]
$ julia -e 'versioninfo()'
Julia Version 0.5.0-dev+1491
Commit 41fb1ba (2015-11-27 16:54 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
  WORD_SIZE: 64
  BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: liblapack.so.3
  LIBM: libopenlibm
  LLVM: libLLVM-3.3
@JeffBezanson JeffBezanson added bug Indicates an unexpected problem or unintended behavior regression Regression in behavior compared to a previous version labels Dec 4, 2015
@JeffBezanson
Copy link
Member

Seems to work in 0.4.

@JeffBezanson
Copy link
Member

Also, excellent catch. Thanks for this.

@StefanKarpinski
Copy link
Member

Should we have a regression test for this somewhere? (Not sure what test file to put it in though.)

@kshyatt
Copy link
Contributor

kshyatt commented Dec 4, 2015

@StefanKarpinski isn't this what test/misc.jl is for? 😉

@StefanKarpinski
Copy link
Member

Ok, we have a test for this now, but it's failing on 0.5. Since this doesn't fail on 0.4, we can actually backport it safely and then merge on 0.5 once the issue is fixed.

StefanKarpinski added a commit that referenced this issue Jan 9, 2016
carnaval added a commit that referenced this issue Jan 21, 2016
carnaval added a commit that referenced this issue Jan 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants