Re: [eigen] segfault in unit-tests with g++-4.2

[ Thread Index | Date Index | More Archives ]

On Sunday 30 September 2007 16:37:45 Michael Olbrich wrote:
> On Sun, Sep 30, 2007 at 04:01:07PM +0200, Benoît Jacob wrote:
> > OK, answer by Richard Guenther, this is not a regression in gcc, this is
> > a bug in eigen :) the reason why it was hard to track down is that it
> > disappears when the relevant functions are inlined.
> >
> > We have yet to fix this bug but at least we now know that it's our bug.
> Hmmm, I only get segfaults for cols() != rows()
> michael

Found it! Indeed it had much to do with cols != rows.

The error was in this line, where we define the array for fixed-size matrix 
storage (in MatrixStorage.h) :

    Scalar m_array[RowsAtCompileTime * ColsAtCompileTime];

Of course this should be:

    Scalar m_array[RowsAtCompileTime * ColsAtCompileTime];

Because of that error, the operator= eventually wrote outside of the matrix's 
storage array, and overwrote a MatrixConstRef's reference, causing the 
reported reference corruption.


Attachment: signature.asc
Description: This is a digitally signed message part.

Mail converted by MHonArc 2.6.19+