Skip to content

Segfault resetting translated solver #7776

@toolCHAINZ

Description

@toolCHAINZ

I ran into an issue while developing the rust z3 bindings. This issue seems to be present in the latest Z3 release.

Here is a (rust) code snippet demonstrating it:

fn solver_translate_issue(){
    let ctx1 = Context::default(); 
    let ctx2 = Context::default();

    let s = Solver::new(&ctx1);  // A solver in ctx1
    let s2 = s.translate(&ctx2); // A solver in ctx2

    // the following two lines execute successfully
    s.reset();
    s.assert(&Bool::from_bool(&ctx1, true));


    s2.reset();
    s2.assert(&Bool::from_bool(&ctx2, true));  // this line segfaults
}

If you check ctx2's error state right before the last line, it is ok, so no exceptions are getting thrown that I can tell.

The s2 solver is actually usable if reset is not called. Also, once assertions have been added to it, it can be reset and assert'd successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions