[eigen] Matrix product crashes when compiled with MSVC 2010 in release

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

I've run into a nasty crash with recent Eigen dev builds.  The
following code reproduces it:

void test()
{
    typedef Eigen::MatrixXd Mat;
    Mat r = Mat::Random(5, 2);
    Mat r2 = Mat::Random(2, 5);
    Mat r3 = r * r2;
    std::cout << r3;
}

It crashes only when the output matrix has an odd number of entries
and only when built in release mode on MSVC 2010 and only when whole
program optimization is turned off.  I suspect that this is a compiler
bug, but perhaps it can be worked around.  I traced the crash to
changeset 3260 (431547872cf7); 3259 works.

Here's the backtrace (lines as in rev 3260, because it's a release
build, debug info is unreliable):

First-chance exception at 0x00ea34bd in EigenTest.exe: 0xC0000005:
Access violation reading location 0xffffffff.

	EigenTest.exe!Eigen::ei_gebp_kernel<double,double,int,4,4,0,0>::operator()(double
* res=0x004d3e20, int resStride=5, const double * blockA=0x0037fc70,
const double * blockB=0x0037fc20, int rows=5, int depth=2, int cols=5,
double alpha=1.0000000000000000, int strideA=2, int strideB=2, int
offsetA=0, int offsetB=0, double * unpackedB=0x0037fba0)  Line 459 +
0x8 bytes	C++

 	EigenTest.exe!Eigen::ei_general_matrix_matrix_product<int,double,0,0,double,0,0,0>::run(int
rows=5, int cols=5, int depth=2, const double * _lhs=0x004d3d20, int
lhsStride=5, const double * _rhs=0x004d3da0, int rhsStride=2, double *
res=0x004d3e20, int resStride=5, double alpha=1.0000000000000000,
Eigen::ei_level3_blocking<double,double> & blocking={...},
Eigen::GemmParallelInfo<int> * info=0x00000000)  Line 203 + 0x37
bytes	C++

 	EigenTest.exe!Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>::scaleAndAddTo<Eigen::Matrix<double,-1,-1,0,-1,-1>
>(Eigen::Matrix<double,-1,-1,0,-1,-1> & dst={...}, double
alpha=1.0000000000000000)  Line 444	C++

 	EigenTest.exe!Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>,Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>
>::evalTo<Eigen::Matrix<double,-1,-1,0,-1,-1>
>(Eigen::Matrix<double,-1,-1,0,-1,-1> & dst={...})  Line 110 + 0x83
bytes	C++

 	EigenTest.exe!test()  Line 9 + 0x97 bytes	C++

 	EigenTest.exe!main()  Line 16	C++


Figuring out ei_gebp_kernel looks daunting--do you (well, Gael is the
person who needs to look at this, I expect) need any additional info?

Thanks,

   -Ilya



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/