[Osi] Adding a row provokes a segfault

Christophe-Marie Duquesne chm.duquesne at gmail.com
Thu Jul 22 08:59:29 EDT 2010


Hi list,

The following program segfaults:

#include <coin/OsiSolverInterface.hpp>
#include <coin/OsiClpSolverInterface.hpp>
#include <coin/CoinPackedVector.hpp>


int main(int argc, const char *argv[])
{
    OsiSolverInterface * solver = new OsiClpSolverInterface();

    CoinPackedVector vector;
    vector.insert(1, 1);

    solver->addRow(vector, 0, 1);

    delete solver;
    return 0;
}

Here is a backtrace with gdb:

#0  0x00330e59 in CoinPackedMatrix::appendMinorVector (this=0x804e9f0,
vecsize=1, vecind=0x804e878, vecelem=0x804e8a8) at
CoinPackedMatrix.cpp:1314
#1  0x0033102a in CoinPackedMatrix::appendMinorVector (this=0x804e9f0,
vec=...) at CoinPackedMatrix.cpp:1345
#2  0x0032da45 in CoinPackedMatrix::appendRow (this=0x804e9f0,
vec=...) at CoinPackedMatrix.cpp:239
#3  0x0019ad10 in OsiClpSolverInterface::addRow (this=0x804afa0,
vec=..., rowlb=0, rowub=1) at OsiClpSolverInterface.cpp:3041

Attached is an archive with this program and a Makefile. Set the OSI
flags according to your system.

Did I do something wrong?

Cheers,
-- 
Christophe-Marie Duquesne
06 84 14 26 82 - mobile
04 76 57 48 06 - g-scop
04 97 23 27 33 - amadeus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-osi.tgz
Type: application/x-gzip
Size: 522 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/osi/attachments/20100722/a367983d/attachment.tgz>


More information about the Osi mailing list