Well this happened:
julia> try_substrtod(::Type{T}, s) where T =
ccall(:jl_try_substrtod, Nullable{T},
(Ptr{UInt8},Csize_t,Csize_t), s, 0, sizeof(s))
try_substrtod (generic function with 1 method)
julia> try_substrtod(s) =
ccall(:jl_try_substrtod, Nullable{Float64},
(Ptr{UInt8},Csize_t,Csize_t), s, 0, sizeof(s))
try_substrtod (generic function with 2 methods)
julia> try_substrtod("10.0")
Nullable{Float64}(10.0)
julia> try_substrtod(Float64, "10.0")
signal (11): Segmentation fault
while loading no file, in expression starting on line 0
julia_struct_has_layout at /home/fabio/Source/Git/Languages/julia/src/cgutils.cpp:442 [inlined]
julia_struct_to_llvm at /home/fabio/Source/Git/Languages/julia/src/cgutils.cpp:470
verify_ccall_sig at /home/fabio/Source/Git/Languages/julia/src/ccall.cpp:1415 [inlined]
emit_ccall at /home/fabio/Source/Git/Languages/julia/src/ccall.cpp:1536
emit_expr at /home/fabio/Source/Git/Languages/julia/src/codegen.cpp:4041
emit_function at /home/fabio/Source/Git/Languages/julia/src/codegen.cpp:5963
jl_compile_linfo at /home/fabio/Source/Git/Languages/julia/src/codegen.cpp:1201
jl_compile_for_dispatch at /home/fabio/Source/Git/Languages/julia/src/gf.c:1627
jl_compile_method_internal at /home/fabio/Source/Git/Languages/julia/src/julia_internal.h:294 [inlined]
jl_call_method_internal at /home/fabio/Source/Git/Languages/julia/src/julia_internal.h:341 [inlined]
jl_apply_generic at /home/fabio/Source/Git/Languages/julia/src/gf.c:2225
do_call at /home/fabio/Source/Git/Languages/julia/src/interpreter.c:75
eval at /home/fabio/Source/Git/Languages/julia/src/interpreter.c:242
jl_interpret_toplevel_expr at /home/fabio/Source/Git/Languages/julia/src/interpreter.c:34
jl_toplevel_eval_flex at /home/fabio/Source/Git/Languages/julia/src/toplevel.c:577
jl_toplevel_eval_in at /home/fabio/Source/Git/Languages/julia/src/builtins.c:484
eval at ./boot.jl:235
unknown function (ip: 0x7fe252cf9d8f)
jl_call_fptr_internal at /home/fabio/Source/Git/Languages/julia/src/julia_internal.h:326 [inlined]
jl_call_method_internal at /home/fabio/Source/Git/Languages/julia/src/julia_internal.h:345 [inlined]
jl_apply_generic at /home/fabio/Source/Git/Languages/julia/src/gf.c:2225
eval_user_input at ./REPL.jl:66
unknown function (ip: 0x7fe0410e1576)
jl_call_fptr_internal at /home/fabio/Source/Git/Languages/julia/src/julia_internal.h:326 [inlined]
jl_call_method_internal at /home/fabio/Source/Git/Languages/julia/src/julia_internal.h:345 [inlined]
jl_apply_generic at /home/fabio/Source/Git/Languages/julia/src/gf.c:2225
macro expansion at ./REPL.jl:97 [inlined]
#1 at ./event.jl:73
unknown function (ip: 0x7fe0410d7d2f)
jl_call_fptr_internal at /home/fabio/Source/Git/Languages/julia/src/julia_internal.h:326 [inlined]
jl_call_method_internal at /home/fabio/Source/Git/Languages/julia/src/julia_internal.h:345 [inlined]
jl_apply_generic at /home/fabio/Source/Git/Languages/julia/src/gf.c:2225
jl_apply at /home/fabio/Source/Git/Languages/julia/src/julia.h:1410 [inlined]
start_task at /home/fabio/Source/Git/Languages/julia/src/task.c:261
unknown function (ip: 0xffffffffffffffff)
Allocations: 2263084 (Pool: 2261779; Big: 1305); GC: 1
[1] 9293 segmentation fault julia
I've posted this on discourse already but since @yuyichao confirmed that there is a bug here somewhere I decided to make it a proper issue.
julia> versioninfo()
Julia Version 0.6.0-pre.alpha.182
Commit 696e1d9fc4* (2017-03-19 17:11 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
It's supposed to throw a Julia error, since that's not a valid function signature in C, but it looks like the detection code may be dereferencing the pointers in the wrong order.
When this is fixed, it will definitely be good to add this as a regression test.
Most helpful comment
When this is fixed, it will definitely be good to add this as a regression test.