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

Arrays changes broke JuMP #17354

Closed
mlubin opened this issue Jul 9, 2016 · 4 comments
Closed

Arrays changes broke JuMP #17354

mlubin opened this issue Jul 9, 2016 · 4 comments
Assignees
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@mlubin
Copy link
Member

mlubin commented Jul 9, 2016

using JuMP
m = Model()
@variable(m, tri_3[(i,j)=[(i,i+2) for i in 1:5],k=i:j])

gives

ERROR: UndefRefError: access to undefined reference
 in copy!(::Base.LinearFast, ::Array{Tuple{Vararg{Any,2}},1}, ::Base.LinearFast, ::Array{Tuple{Any,Any},1}) at ./abstractarray.jl:412
 in rehash!(::Dict{Tuple{Vararg{Any,2}},JuMP.Variable}, ::Int64) at ./dict.jl:483
 in _setindex!(::Dict{Tuple{Vararg{Any,2}},JuMP.Variable}, ::JuMP.Variable, ::Tuple{Tuple{Int64,Int64},Int64}, ::Int64) at ./dict.jl:606
 in setindex!(::Dict{Tuple{Vararg{Any,2}},JuMP.Variable}, ::JuMP.Variable, ::Tuple{Tuple{Int64,Int64},Int64}) at ./dict.jl:626
 in setindex!(::JuMP.JuMPDict{JuMP.Variable,2}, ::JuMP.Variable, ::Tuple{Int64,Int64}, ::Int64) at /home/mlubin/.julia/v0.5/JuMP/src/JuMPContainer.jl:49
 in macro expansion; at /home/mlubin/.julia/v0.5/JuMP/src/macros.jl:137 [inlined]
 in anonymous at ./<missing>:?
 in eval(::Module, ::Any) at ./boot.jl:234
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46

This seems to have been broken for quite a while but I haven't been using 0.5. I can spend a bit more time to generate a pure julia error case, but opening this in case the issue is obvious.
CC @IainNZ @joehuchette @tkelman @timholy

Version:

julia> versioninfo()
Julia Version 0.5.0-dev+5247
Commit dad6836 (2016-07-09 01:29 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, ivybridge)
@timholy
Copy link
Member

timholy commented Jul 10, 2016

This actually looks like a type-system error: the key line in the backtrace (obtained with --inline=no) is

in copy!(::Array{Tuple{Vararg{Any,2}},1}, ::Array{Tuple{Any,Any},1}) at ./abstractarray.jl:423

Vararg{Any,2} should be instantiated as Tuple{Any,Any}. Once these are the same, then rather than calling this definition it should call this one.

@timholy
Copy link
Member

timholy commented Jul 10, 2016

It seems possible this is the same as #17350, and if so that a possible fix might already be on the way.

@timholy
Copy link
Member

timholy commented Jul 10, 2016

To explain a little further, what's happening is that copy! is getting called as a consequence of Dict rehashing, and the array that's being copied has undefined elements in it. The Array-specific copy! method handles #undef.

@timholy timholy added the types and dispatch Types, subtyping and method dispatch label Jul 10, 2016
@JeffBezanson
Copy link
Member

Reverting the offending commit from #17350 doesn't seem to fix this.

@JeffBezanson JeffBezanson self-assigned this Jul 10, 2016
JeffBezanson added a commit that referenced this issue Jul 12, 2016
fix #17354, expand `Tuple{Vararg{Any,2}}` on construction
mfasi pushed a commit to mfasi/julia that referenced this issue Sep 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

3 participants