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

Segfault in baremodule from trying to call an external type #12612

Closed
mbauman opened this issue Aug 13, 2015 · 1 comment
Closed

Segfault in baremodule from trying to call an external type #12612

mbauman opened this issue Aug 13, 2015 · 1 comment

Comments

@mbauman
Copy link
Sponsor Member

mbauman commented Aug 13, 2015

This is an error in any case (ideally a call MethodError, I guess), but it probably shouldn't be a segfault:

julia> type Foo; end
       baremodule A
         import Main: Foo
         f() = Foo()
       end
       A.f()
ERROR: TypeError: builtin_tfunction: in typeassert, expected Function, got Type{Foo}
 in builtin_tfunction at /Users/mbauman/Applications/julia-0.4/lib/julia/sys-debug.dylib
 in abstract_call at /Users/mbauman/Applications/julia-0.4/lib/julia/sys-debug.dylib
 in abstract_eval_call at /Users/mbauman/Applications/julia-0.4/lib/julia/sys-debug.dylib
 in abstract_eval at /Users/mbauman/Applications/julia-0.4/lib/julia/sys-debug.dylib
 in typeinf_uncached at /Users/mbauman/Applications/julia-0.4/lib/julia/sys-debug.dylib
 in typeinf at /Users/mbauman/Applications/julia-0.4/lib/julia/sys-debug.dylib
 in typeinf_ext at /Users/mbauman/Applications/julia-0.4/lib/julia/sys-debug.dylib

julia> baremodule B
         f() = Main.Foo()
       end
       B.f()

signal (11): Segmentation fault: 11
mtcache_hash_lookup at /Users/mbauman/Code/julia-0.4/src/gf.c:153
jl_method_table_assoc_exact at /Users/mbauman/Code/julia-0.4/src/gf.c:249
jl_apply_generic at /Users/mbauman/Code/julia-0.4/src/gf.c:1629
f at none:2
jlcall_f_21113 at  (unknown line)
jl_apply at /Users/mbauman/Code/julia-0.4/src/./julia.h:1264
jl_trampoline at /Users/mbauman/Code/julia-0.4/src/builtins.c:996
jl_apply at /Users/mbauman/Code/julia-0.4/src/./julia.h:1264
jl_apply_generic at /Users/mbauman/Code/julia-0.4/src/gf.c:1674
jl_apply at /Users/mbauman/Code/julia-0.4/src/./julia.h:1264
do_call at /Users/mbauman/Code/julia-0.4/src/interpreter.c:65
eval at /Users/mbauman/Code/julia-0.4/src/interpreter.c:213
jl_interpret_toplevel_expr at /Users/mbauman/Code/julia-0.4/src/interpreter.c:27
jl_toplevel_eval_flex at /Users/mbauman/Code/julia-0.4/src/toplevel.c:525
jl_toplevel_eval_flex at /Users/mbauman/Code/julia-0.4/src/toplevel.c:473
jl_toplevel_eval at /Users/mbauman/Code/julia-0.4/src/toplevel.c:548
jl_toplevel_eval_in at /Users/mbauman/Code/julia-0.4/src/builtins.c:567
jl_f_top_eval at /Users/mbauman/Code/julia-0.4/src/builtins.c:598
eval_user_input at REPL.jl:63
jlcall_eval_user_input_21080 at  (unknown line)
jl_apply at /Users/mbauman/Code/julia-0.4/src/./julia.h:1264
jl_apply_generic at /Users/mbauman/Code/julia-0.4/src/gf.c:1650
anonymous at task.jl:92
jl_apply at /Users/mbauman/Code/julia-0.4/src/./julia.h:1264
jl_trampoline at /Users/mbauman/Code/julia-0.4/src/builtins.c:996
jl_apply at /Users/mbauman/Code/julia-0.4/src/./julia.h:1264
start_task at /Users/mbauman/Code/julia-0.4/src/task.c:230
Segmentation fault: 11
@yuyichao
Copy link
Contributor

I guess the problem is that the call function for a module is a bottom function?

yuyichao added a commit that referenced this issue Aug 13, 2015
Throw an error when `call` is not a generic function for the fallback case.
Do not panic in type inference if call is not defined
Add generic function assertion in jl_apply_generic
yuyichao added a commit that referenced this issue Aug 13, 2015
Throw an error when `call` is not a generic function for the fallback case
Do not panic in type inference if call is not defined
Add generic function assertion in jl_apply_generic
yuyichao added a commit that referenced this issue Aug 17, 2015
Throw an error when `call` is not a generic function for the fallback case
Do not panic in type inference if call is not defined
Add generic function assertion in jl_apply_generic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants