Julia: Unreachable reached error

Created on 17 Nov 2018  路  5Comments  路  Source: JuliaLang/julia

The following code

struct Mat1x1{T} <: AbstractMatrix{T}
    x::T
    n
end
Base.size(A::Mat1x1) = (A.n, A.n)
Base.getindex(A::Mat1x1, idx...) = A.x
function trimat(n)
    Mat1x1{Int}(1, n)
end

struct MatandVec{T, MT <: Int, MVT <: Vector{MT}}
    A::Mat1x1{T}
    x::MVT
end
function MatandVec(x)
    A = Mat1x1{Int}(1, 1)
    MatandVec{Int, eltype(x), typeof(x)}(A, x)
end
matandvec() = MatandVec([1])

mutable struct S{MT <: Int, MVT <: Vector{MT}}
    a::MatandVec{Int, MT, MVT}
    b::Vector{MatandVec{Int, MT, MVT}}
end

function f()
    x = matandvec()
    y = matandvec()
    a = MatandVec(y.x)
    b = MatandVec{eltype(x.A + y.A), Int, Vector{Int}}[]
    S(a, b)
end

f()

with Julia v1.0.2 produces

Unreachable reached at 0x7f4e37262288

signal (4): Illegal instruction
in expression starting at /home/blegat/git/bug/bug.jl:34
f at /home/blegat/git/bug/bug.jl:31
jl_fptr_trampoline at /usr/bin/../lib/libjulia.so.1 (unknown line)
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: 0x7f4e5ffbbab7)
unknown function (ip: 0x7f4e5ffbb860)
unknown function (ip: 0x7f4e5ffbc828)
unknown function (ip: 0x7f4e5ffbcf04)
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f4e514d26cf)
unknown function (ip: 0xffffffffffffffff)
unknown function (ip: 0x7f4e5ffbd3cc)
unknown function (ip: 0x7f4e5e9da06c)
unknown function (ip: 0x7f4e5e9b224e)
jl_load at /usr/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: 0x7f4e55d42ce2)
unknown function (ip: 0x7f4e55d4de0b)
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: 0x7f4e55d4d40a)
unknown function (ip: 0x7f4e55d4db17)
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: 0x55642045e6e3)
unknown function (ip: 0x55642045e0a8)
__libc_start_main at /usr/bin/../lib/libc.so.6 (unknown line)
unknown function (ip: 0x55642045e15d)
Allocations: 2019650 (Pool: 2019401; Big: 249); GC: 3
[1]    12743 illegal hardware instruction (core dumped)

Do not look for any meaning in the code, it is simply a reduced example from https://github.com/JuliaOpt/SumOfSquares.jl/issues/48 but it does not make any sense :-P

Most helpful comment

Probably fixed by #29986.

All 5 comments

Slightly reduced:

struct c{d, e , g <: Vector{e}}
    h
    i::g
end
function c(i)
    h =  1
    c{Int, eltype(i), typeof(i)}(h, i)
end
j() = c([1])
struct k{e , g }
    a::c{Int, e, g}
    b::Vector{c{Int, e, g}}
end
function f()
      l = j()
    a = c(l.i)
    b = c{eltype( l.h), Int, Vector{Int}}[]
    k(a, b)
end
f()

I have just tested on master and it seems resolved.

Julia Version 1.1.0-DEV.673
Commit 90e3155fc4 (2018-11-17 16:06 UTC)
DEBUG build
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

Is there a way to download julia nightly binaries from previous days ? Having to recompile julia during bisection makes the process quite long.

Yes. You can see available downloads here: https://julialangnightlies-s3.julialang.org/

Probably fixed by #29986.

@JeffBezanson I can confirm it.

  • With 604046c1e1063d393261c07fc66a4f825b244697 (i.e. the commit just before #29986 was merged), the bug is still there
  • With 11243da6441c2b5ef6a24dc1dee3507f224d6b55 (i.e. the merge commit for #29986), the bug is fixed.
Was this page helpful?
0 / 5 - 0 ratings