Skip to content

Segfault after deepcopy of MixedIntegerLinearProgram #15159

@jvkersch

Description

@jvkersch

I wanted to make a copy of a linear program and modify the copy somewhat further. Using deepcopy I get a segfault (tested under 5.12.beta4) running the following:

sage: p = MixedIntegerLinearProgram()
sage: w = p.new_variable()
sage: q = deepcopy(p)
sage: q.add_constraint(w[0] >= 0)
------------------------------------------------------------------------
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and is not properly wrapped with sig_on(), sig_off(). You might
want to run Sage under gdb with 'sage -gdb' to debug this.
Sage will now terminate.
------------------------------------------------------------------------

The same segfault happens when one instead defines a new variable for the new linear program and tries to add constraints in terms of that variable:

sage: p = MixedIntegerLinearProgram()
sage: q = deepcopy(p)
sage: w = q.new_variable()
sage: q.add_constraint(w[0] >= 0)

Everything works well when using copy instead of deepcopy. Nevertheless, could this be related to #11588?

Depends on #20414

CC: @videlec @vbraun @dimpase

Component: linear programming

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/15159

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions