-
Notifications
You must be signed in to change notification settings - Fork 12
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
Segmentation fault with julia v0.6 #13
Comments
rdeits
added a commit
to rdeits/CDDLib.jl
that referenced
this issue
May 30, 2017
This should be closed as out-dated. |
julia> using CDDLib
julia> import CDDLib: Cdd_ErrorType, Cdd_boolean, @dd_ccall, Cdd_MatrixData, Cdd_rowrange,
fulldim, myerror, myfree, CDDInequalityMatrix
julia> using Polyhedra
julia> import LinearAlgebra
julia> eye(T, n) = LinearAlgebra.I(n) * one(T)
eye (generic function with 1 method)
julia> A = eye(Int, 2)
2×2 Diagonal{Int64, Vector{Int64}}:
1 ⋅
⋅ 1
julia> b = [1, 1]
2-element Vector{Int64}:
1
1
julia> h = Polyhedra.hrep(A, b)
H-representation MixedMatHRep{Int64, Diagonal{Int64, Vector{Int64}}}:
2-element iterator of HalfSpace{Int64, Vector{Int64}}:
HalfSpace([1, 0], 1)
HalfSpace([0, 1], 1)
julia> matrix = CDDInequalityMatrix(h)
H-representation CDDInequalityMatrix{Rational{BigInt}, GMPRational}:
2-element iterator of HalfSpace{Rational{BigInt}, Vector{Rational{BigInt}}}:
HalfSpace(Rational{BigInt}[1, 0], 1//1)
HalfSpace(Rational{BigInt}[0, 1], 1//1)
julia> i = Cdd_rowrange(1)
1
julia> len = fulldim(matrix) + 1
3
julia> err = Ref{Cdd_ErrorType}(0)
Base.RefValue{Int32}(0)
julia> certificateGMPRat = zeros(GMPRational, len)
3-element Vector{GMPRational}:
0//1
0//1
0//1
julia> found = (@dd_ccall Redundant Cdd_boolean (Ptr{Cdd_MatrixData{GMPRational}}, Cdd_rowrange, Ptr{GMPRational}, Ref{Cdd_ErrorType}) matrix.matrix i certificateGMPRat err)
0
julia> myerror("foo", err[])
julia> certificate = Array{Rational{BigInt}}(certificateGMPRat)
3-element Vector{Rational{BigInt}}:
1
2
1
julia> myfree(certificateGMPRat)
julia> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The CDDLib.jl and Polyhedra.jl unit tests fail with segfaults on Julia v0.6. The smallest reproducible example I can find so far is this:
which is distilled from the call to
redundant(matrix, i)
intest/board.jl
.Removing the final call to
myfree(certificateGMPRat)
prevents the segfault, but I don't understand enough about GMP to know if that's actually a good idea.This may be related to the issue alluded to here: https://discourse.julialang.org/t/bindings-to-external-lib-work-with-0-5-but-fail-with-0-6-rc1/3734/2 . Apparently in julia v0.5, some finalizers were not actually being run, so it's possible that there's been a double-free somewhere in this code which was hidden by that v0.5 bug but revealed on v0.6.
The text was updated successfully, but these errors were encountered: