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

Calling @code_native on a function in a module segfaults. #15606

Closed
KristofferC opened this issue Mar 23, 2016 · 10 comments
Closed

Calling @code_native on a function in a module segfaults. #15606

KristofferC opened this issue Mar 23, 2016 · 10 comments
Assignees

Comments

@KristofferC
Copy link
Sponsor Member

This segfaults julia 0.5:

module Foo
    foo() = 1
end

# Note lack of parenthesis
@code_native Foo.foo

In 0.4.3 this gives:

ERROR: no method found for the specified argument types
@vtjnash
Copy link
Sponsor Member

vtjnash commented Mar 23, 2016

it looks like the key failure here is that it tries to emit code for the builtin function Core.getfield(?), which has the following AST, so it fails in jl_new_lambda_info:

(lldb) p jl_(method->ast) Expr(:lambda)::Any

@rfourquet
Copy link
Member

Is it the same problem as the segfault in @code_native applicable(typemax, Int) ?

@yuyichao
Copy link
Contributor

Yes, applicable is also a builtin.

@mauro3
Copy link
Contributor

mauro3 commented Jul 22, 2016

Another one:

    _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0-pre+5609 (2016-07-22 07:00 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 21f28c9* (0 days old master)
|__/                   |  x86_64-pc-linux-gnu

julia> first(take(1:Inf,2))

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
jl_f_tuple at /home/mauro/julia/julialang_upstream/src/builtins.c:648
eval_user_input at ./REPL.jl:74
jl_call_method_internal at /home/mauro/julia/julialang_upstream/src/julia_internal.h:177 [inlined]
jl_apply_generic at /home/mauro/julia/julialang_upstream/src/gf.c:2034
macro expansion at ./REPL.jl:92 [inlined]
#3 at ./event.jl:46
jl_call_method_internal at /home/mauro/julia/julialang_upstream/src/julia_internal.h:177 [inlined]
jl_apply_generic at /home/mauro/julia/julialang_upstream/src/gf.c:2034
jl_apply at /home/mauro/julia/julialang_upstream/src/julia.h:1394 [inlined]
start_task at /home/mauro/julia/julialang_upstream/src/task.c:253
unknown function (ip: 0xffffffffffffffff)
Allocations: 1621003 (Pool: 1620110; Big: 893); GC: 0
zsh: segmentation fault (core dumped)  julia5

@mauro3
Copy link
Contributor

mauro3 commented Jul 22, 2016

I'm on a roll! This segfaults too f(aa) = (a,b=aa.a,aa.b; a+b) as does this mal-formed expression function f(aa)a,b=aa.a,aa.b; a+b).

@yuyichao
Copy link
Contributor

Those are unrelated.

@mauro3
Copy link
Contributor

mauro3 commented Jul 22, 2016

You're sure? The backtrack is exactly the same though (modulo different allocation numbers). Should I open another issue?

@yuyichao
Copy link
Contributor

You're sure?

Yes.

Should I open another issue?

No, #17548

@mauro3
Copy link
Contributor

mauro3 commented Jul 22, 2016

Thanks. No wonder it was so easy to find other examples...

@yuyichao
Copy link
Contributor

The backtrack is exactly the same though (modulo different allocation numbers)

Also note that both the backtrace and the allocation number are useless in terms of directly identify the cause of the failure. They are only useful when debugging the issue.

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
None yet
Projects
None yet
Development

No branches or pull requests

5 participants