Segmentation fault when multiplying a DiagonalMatrix and a Block
Submitted by Filippo Basso
Assigned to Nobody
Link to original bugzilla bug (#987)
Version: 3.2
Operating system: Linux
Description
With a simple code like the one below, everything compiles well but I get a segmentation fault on last line:
Eigen::Matrix3Xd points = Eigen::Matrix3Xd::Zero(3, 2);
Eigen::DiagonalMatrix<double, 2> diagonal(1, 2);
Eigen::Matrix2Xd result = diagonal * points.topRows<2>();
I use Eigen 3.2.0 and compile with g++ 4.8.2 on Ubuntu 14.04 64bit.
The segmentation fault happens both in (cmake) Debug and Release modes.
I also tried to enable/disable -std=c++11 but nothing changed.
The error goes away if the result is not saved, i.e.:
Eigen::Matrix3Xd points = Eigen::Matrix3Xd::Zero(3, 2);
Eigen::DiagonalMatrix<double, 2> diagonal(1, 2);
diagonal * points.topRows<2>();
or if the block operation is saved in a temporary matrix, i.e.:
Eigen::Matrix3Xd points = Eigen::Matrix3Xd::Zero(3, 2);
Eigen::DiagonalMatrix<double, 2> diagonal(1, 2);
Eigen::Matrix2Xd tmp = points.topRows<2>();
Eigen::Matrix2Xd result = diagonal * tmp;
Looking at the gdb backtrace it seems an SSE-related bug: http://pastebin.com/NqZuVWZ1