An issue reporting a segmentation fault has been recently filed for Cuba.jl
. The minimal way to reproduce the crash is the following:
using Cuba
integrand = (x,f) -> f[] = cos(x[])
integral = Vector{Cdouble}(1)
error = Vector{Cdouble}(1)
prob = Vector{Cdouble}(1)
neval = Ref{Int64}(0)
fail = Ref{Cint}(0)
nregions = Ref{Cint}(0)
ccall((:llVegas, Cuba.libcuba), Cdouble,
(Cint, # ndim
Cint, # ncomp
Ptr{Void}, # integrand
Any, # userdata
Int64, # nvec
Cdouble, # reltol
Cdouble, # abstol
Cint, # flags
Cint, # seed
Int64, # minevals
Int64, # maxevals
Int64, # nstart
Int64, # nincrease
Int64, # nbatch
Cint, # gridno
Ptr{Cchar}, # statefile
Ptr{Void}, # spin
Ptr{Int64}, # neval
Ptr{Cint}, # fail
Ptr{Cdouble}, # integral
Ptr{Cdouble}, # error
Ptr{Cdouble}),# prob
Cint(1), Cint(1), Cuba.integrand_ptr(integrand), integrand, Int64(1),
1e-4, 1e-12, Cint(0), Cint(0), Int64(0),
Int64(255), # ← this is maxevals
Int64(1000), Int64(500), Int64(1000), Cint(0), "", C_NULL,
neval, fail, integral, error, prob)
If maxevals <= 255
, the ccall
would case a segault, otherwise it works. What makes this issue even weirder is that this isn’t reproducible on all platform, but only on platforms where these tests fail:
- AppVeyor (fails on Win64 + Julia 0.5 and Julia 0.6; Win32 + Julia 0.7)
- Travis (fails on GNU/Linux + Julia 0.5 and 0.6; macOS + Julia 0.5 and 0.7)
Any clue about what may cause the segmentation fault?