[Coin-discuss] Segmentation fault in CoinPackedMatrix

Jesper Hansen jesper at carmen.se
Thu Jan 22 04:27:55 EST 2004


Ok. I tried to add the COIN_DEBUG and it actually throws the exception if 
the minor dimension is not set to 2. If I do a check.setDimensions(2,0) 
then it works. As I read the code this must always be done? As you note, 
the only reason for having this throw block is a bug in the resize or that 
it is simply an invariant? And by the way the small code snip that I 
did seems to dump only on Linux and not MSV6 while the orginal code dumps 
on both. Obviously this was without COIN_DEBUG defined. The fix for now is 
to call setDimensions which is possible in my application since the number 
of rows is constant. Thanks.

'Jesper

On Wed, 21 Jan 2004, Matthew Galati wrote:

> Hi Jespser,
> 
> I cannot seem to repeat the stack dump you posted earlier (using gcc 
> 3.3.2 or MSVC6). But here is a guess... check your Coin lib Makefile and 
> see if you are compiling with -DCOIN_DEBUG. If so, you will see, in 
> CoinPackedMatrix::appendMajorVector, that if any of your row indices are 
> greater than minorDim_, that it will throw. If you are not using a 
> try/catch block, the code will just crash and exit. Does your code 
> snippet (below) crash and produce the stack you posted earlier? I am not 
> sure why the throw block is in appendMajorVector when COIN_DEBUG is 
> defined, since later in the function, it calls the resize function. 
> Unless someone knows that the resize function might (?) have a bug. A 
> quick fix, if you want, is to set the row dimension before hand, so that 
> appendCol does not get into the resize function ( 
> check.setDimensions(0,2) ).
> 
> Matt
> 
> 
> 
> >Here is the smallest example that I could think off... ;-)
> >
> >#include <CoinPackedMatrix.hpp>
> >#include <CoinPackedVector.hpp>
> >
> >int main(int argc, char** argv) {
> >  CoinPackedMatrix check;
> >  CoinPackedVector z;
> >  z.insert(1,-1);
> >  check.appendCol(z);
> >}
> >
> >I'm running on Linux with g++ (GCC) 3.2.3 20030502 (Red Hat Linux 
> >3.2.3-20).
> >
> >Hope that this is helpful.
> >
> >On Wed, 21 Jan 2004, J P Fasano wrote:
> >
> >  
> >
> >>
> >>
> >>Can you provide a small test case which recreates the problem?
> >>
> >>JP Fasano
> >>jpfasano at us.ibm.com
> >>(914)945-1324  (tie line 862-1324)
> >>COIN www.coin-or.org
> >>
> >>_______________________________________________
> >>Coin-discuss mailing list
> >>Coin-discuss at www-124.ibm.com
> >>http://www-124.ibm.com/developerworks/oss/mailman/listinfo/coin-discuss
> >>
> >>    
> >>
> >
> >  
> >
> 
> 

-- 
Jesper Hansen, mailto:Jesper at carmenconsulting.com
Carmen Consulting, Købmagergade 53, Copenhagen K, Denmark 
Tel.: +45 33 17 91 92    Mobil: +45 61 33 29 69
http://www.carmenconsulting.com




More information about the Coin-discuss mailing list