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

Illegal instruction with 0.6 #21243

Closed
tkoolen opened this issue Mar 31, 2017 · 3 comments
Closed

Illegal instruction with 0.6 #21243

tkoolen opened this issue Mar 31, 2017 · 3 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior compiler:inference Type inference types and dispatch Types, subtyping and method dispatch
Milestone

Comments

@tkoolen
Copy link
Contributor

tkoolen commented Mar 31, 2017

The following code:

using Base.Test

type DirectedGraph{V, E}
    vertices::Vector{V}
    edges::Vector{E}
    DirectedGraph{V, E}(v::V) where {V, E} = new{V, E}([v], E[])
end

type SpanningTree{V, E}
    graph::DirectedGraph{V, E}
    root::V
    edges::Vector{E}
end
SpanningTree{V, E}(g::DirectedGraph{V, E}, root::V, edges::AbstractVector{E}) = SpanningTree{V, E}(g, root, E[])
SpanningTree{V, E}(g::DirectedGraph{V, E}, root::V, next_edge = first) = SpanningTree(g, root, E[])

type RigidBody
end

type Joint{T<:Number}
end

type Mechanism{T<:Number}
    graph::DirectedGraph{RigidBody, Joint{T}}
    tree::SpanningTree{RigidBody, Joint{T}}

    function Mechanism{T}(rootBody::RigidBody; gravity::Bool = false) where T
        graph = DirectedGraph{RigidBody, Joint{T}}(rootBody)
        tree = SpanningTree(graph, rootBody, Joint{T}[])
        new{T}(graph, tree)
    end
end

function remove_fixed_tree_joints2!(mechanism::Mechanism, root::RigidBody)
    newtreejoints = setdiff(mechanism.tree.edges, Joint{Float64}[])
    tree = SpanningTree(mechanism.graph, root, newtreejoints)
end

@testset "bla" begin
    root = RigidBody()
    m = Mechanism{Float64}(root)
    remove_fixed_tree_joints2!(m, root)
end

results in

signal (4): Illegal instruction                                                                                                                                                                                                                                                
while loading /home/twan/code/RigidBodyDynamics/v0.6/RigidBodyDynamics/illegal_instruction.jl, in expression starting on line 39                                                                                                                                               
macro expansion at /home/twan/code/RigidBodyDynamics/v0.6/RigidBodyDynamics/illegal_instruction.jl:42 [inlined]                                                                                                                                                                
macro expansion at ./test.jl:853 [inlined]                                                                                                                                                                                                                                     
anonymous at ./<missing> (unknown line)                                                                                                                                                                                                                                        
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:326 [inlined]                                                                                                                                                                
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:345 [inlined]                                                                                                                                                              
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:589                                                                                                                                                                                
jl_parse_eval_all at /home/centos/buildbot/slave/package_tarball64/build/src/ast.c:873                                                                                                                                                                                         
jl_load at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:616                                                                                                                                                                                              
include_from_node1 at ./loading.jl:539                                                                                                                                                                                                                                         
unknown function (ip: 0x7f2f0f34540b)                                                                                                                                                                                                                                          
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:326 [inlined]                                                                                                                                                                
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:345 [inlined]                                                                                                                                                              
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:2234                                                                                                                                                                                          
include at ./sysimg.jl:14                                                                                                                                                                                                                                                      
unknown function (ip: 0x7f2f0f1e9e3b)                                                                                                                                                                                                                                          
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:326 [inlined]                                                                                                                                                                
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:345 [inlined]                                                                                                                                                              
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:2234                                                                                                                                                                                          
process_options at ./client.jl:305                                                                                                                                                                                                                                             
_start at ./client.jl:371                                                                                                                                                                                                                                                      
unknown function (ip: 0x7f2f0f372968)                                                                                                                                                                                                                                          
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:326 [inlined]                                                                                                                                                                
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:345 [inlined]                                                                                                                                                              
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:2234
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/ui/../src/julia.h:1416 [inlined]
true_main at /home/centos/buildbot/slave/package_tarball64/build/ui/repl.c:127
main at /home/centos/buildbot/slave/package_tarball64/build/ui/repl.c:264
__libc_start_main at /build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:291
unknown function (ip: 0x40170c)
Allocations: 1670963 (Pool: 1669536; Big: 1427); GC: 0
Illegal instruction (core dumped)

Sorry that the example is still so long, but I had trouble reducing the example further.

Output of versioninfo() on my Linux machine:

Julia Version 0.6.0-pre.alpha.327
Commit 2da9afc (2017-03-30 17:24 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-6950X CPU @ 3.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)

The same error happens on OSX:

Julia Version 0.6.0-pre.alpha.327
Commit 2da9afce66 (2017-03-30 17:24 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)

LLDB results on the OSX machine:

$ lldb /Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia
$ process launch
<paste example above>

Process 90761 stopped
* thread #1: tid = 0x35e7eb, 0x0000000318ec6e32, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x0000000318ec6e32
->  0x318ec6e32: ud2    
    0x318ec6e34: leaq   0x27f41c8(%r13), %rdi
    0x318ec6e3b: addq   $0x35cc698, %r13          ; imm = 0x35CC698 
    0x318ec6e42: movabsq $0x100064a50, %rbx        ; imm = 0x100064A50 

Possibly related to #21216, #20961?

@yuyichao
Copy link
Contributor

Probably unrelated to those two issues. What's the jlapi field of the method being called? (In the debugger)

@tkoolen
Copy link
Contributor Author

tkoolen commented Mar 31, 2017

I don't know how to check that; I'm not super familiar with LLDB, sorry. Here's some more info at least:

(lldb) bt
* thread #1: tid = 0x35fcb7, 0x00000003181f6495, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x00000003181f6495
    frame #1: 0x000000010003a3ff libjulia.dylib`jl_toplevel_eval_flex [inlined] jl_call_fptr_internal(nargs=1) + 2207 at julia_internal.h:326 [opt]
    frame #2: 0x000000010003a3ec libjulia.dylib`jl_toplevel_eval_flex [inlined] jl_call_method_internal(nargs=1) + 90 at julia_internal.h:345 [opt]
    frame #3: 0x000000010003a392 libjulia.dylib`jl_toplevel_eval_flex(e=<unavailable>, fast=<unavailable>, expanded=<unavailable>) + 2098 at toplevel.c:589 [opt]
    frame #4: 0x000000010001edcb libjulia.dylib`jl_toplevel_eval_in(m=<unavailable>, ex=0x000000010b126f50) + 523 at builtins.c:484 [opt]
    frame #5: 0x0000000104160b0a sys.dylib`julia_eval_18043 + 10 at boot.jl:235 [opt]
    frame #6: 0x0000000104160b20 sys.dylib`jlcall_eval_18042 + 16
    frame #7: 0x00000003181ee21b
    frame #8: 0x00000003181ee4b7
    frame #9: 0x00000003181e72b4
    frame #10: 0x00000003181e7550
    frame #11: 0x000000010002af41 libjulia.dylib`start_task [inlined] jl_apply(args=<unavailable>, nargs=1) + 5 at julia.h:1416 [opt]
    frame #12: 0x000000010002af3c libjulia.dylib`start_task + 380 at task.c:261 [opt]

(lldb) frame select 1
frame #1: 0x000000010003a3ff libjulia.dylib`jl_toplevel_eval_flex [inlined] jl_call_fptr_internal(nargs=1) + 2207 at julia_internal.h:326 [opt]
(lldb) frame variable
(uint32_t) nargs = 1
(jl_value_t *) dummy_f_arg = 0x0000000000000000
(jl_value_t *) dummy_f_arg = 0x0000000000000000
(jl_module_t *) jl_internal_main_module = 0x0000000107038250
(int) jl_lineno = 0
(const char *) jl_filename = 0x0000000100133fb4 "no file"
(int) i = 0
(jl_value_t *) require_func = 0x0000000000000000

@yuyichao yuyichao changed the title Illegal instruction in jl_call_fptr_internal with 0.6 Illegal instruction with 0.6 Mar 31, 2017
@yuyichao yuyichao added the compiler:inference Type inference label Mar 31, 2017
@JeffBezanson JeffBezanson added bug Indicates an unexpected problem or unintended behavior types and dispatch Types, subtyping and method dispatch labels Apr 3, 2017
@JeffBezanson
Copy link
Member

Seems to come down to this type intersection issue:

julia> typeintersect(Tuple{Ref{Ref{T}} where T, Ref},
                     Tuple{Ref{T}, Ref{T}} where T)
Union{}

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 compiler:inference Type inference types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

3 participants