Closed goretkin closed 9 months ago
It seems as some objects are garbage collected before they are used within the call to add(solver, c == 1)
. For me it works if I expand the lifetime of the object ctx
with GC.@preserve
. That is, using GC.@preserve ctx add(solver, c == 1)
instead of add(solver, c == 1)
works in my case. I'm however not yet sure if this is really the solution, I need to investigate a bit further. Let me know if that works for you.
Yup, that fixes it for me! Thanks for taking a look at it!
I tried to learn a bit more about CxxWrap.jl
to see if this is expected behavior, or to see if there's a fix regarding whether being used, but I didn't learn enough. I hope it's okay to ping @barche to offer some advice.
It seems this segfault is caused by https://github.com/JuliaInterop/CxxWrap.jl/issues/256
Just an update -- this actually works now! :-)
This snippet of code reliably segfaults:
Sometimes with
or
or
I reproduced the segfault in the CI of this repo:
https://github.com/goretkin/MakeJuliaZ3Segfault/runs/1410898097#step:4:51
Errors seem to point to: https://github.com/Z3Prover/z3/blob/e16acd0965bcb679e54c451eba61a4a8ed474a03/src/ast/ast.cpp#L423-L435