Skip to content

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

@xitology

Description

@xitology
$ 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorregressionRegression in behavior compared to a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions