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

Stack overflow and segfault for x' * D * x #517

Closed
dpsanders opened this issue Apr 20, 2018 · 3 comments · Fixed by JuliaLang/julia#26924
Closed

Stack overflow and segfault for x' * D * x #517

dpsanders opened this issue Apr 20, 2018 · 3 comments · Fixed by JuliaLang/julia#26924
Labels
bug Something isn't working system:mac Affects only macOS

Comments

@dpsanders
Copy link

dpsanders commented Apr 20, 2018

julia> using LinearAlgebra

julia> x = [1, 2, 3]
3-element Array{Int64,1}:
 1
 2
 3

julia> D = Diagonal(x)
3×3 Diagonal{Int64,Array{Int64,1}}:
  1    
   2  
     3

julia> x' * D * x
ERROR: StackOverflowError:
Stacktrace:
 [1] Type at ./boot.jl:391 [inlined]
 [2] similar at ./array.jl:262 [inlined]
 [3] similar at /Users/davidsanders/development/julia-dev/usr/share/julia/stdlib/v0.7/LinearAlgebra/src/adjtrans.jl:143 [inlined]
 [4] copymutable at ./abstractarray.jl:798 [inlined]
 [5] copy at ./abstractarray.jl:748 [inlined]
 [6] *(::Adjoint{Int64,Array{Int64,1}}, ::Diagonal{Int64,Array{Int64,1}}) at /Users/davidsanders/development/julia-dev/usr/share/julia/stdlib/v0.7/LinearAlgebra/src/diagonal.jl:484 (repeats 79998 times)

julia> x' * Diagonal(x) * x
Segmentation fault: 11
julia> versioninfo()
Julia Version 0.7.0-DEV.4909
Commit 5912b14 (2018-04-19 21:08 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin15.0.0)
  CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
Environment:
@JeffBezanson
Copy link
Member

The segfault I believe is platform-specific (e.g. JuliaLang/julia#17109); sadly we still seem to crash on some stack overflows on mac. Linux gives the StackOverflowError each time. The stack overflow of course is due to a genuine method circularity.

@JeffBezanson JeffBezanson added bug Something isn't working system:mac Affects only macOS linear algebra labels Apr 20, 2018
@ufechner7
Copy link

But this code works without any error on 0.6.1 . Why is there a "genuine method circularity" in 0.7?

@martinholters
Copy link
Member

Copying a row vector gives a row vector again, so these just recurse infinitely:
https://github.com/JuliaLang/julia/blob/89268890342851757f1eec9e7df323ee1b20f56b/stdlib/LinearAlgebra/src/diagonal.jl#L482-L485
Also an indication that these methods are not exercised at all in our tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working system:mac Affects only macOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants