This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 987 - Segmentation fault when multiplying a DiagonalMatrix and a Block
Summary: Segmentation fault when multiplying a DiagonalMatrix and a Block
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - matrix products (show other bugs)
Version: 3.2
Hardware: x86 - SSE Linux
: High Crash
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-31 18:31 UTC by Filippo Basso
Modified: 2019-12-04 14:26 UTC (History)
2 users (show)



Attachments

Description Filippo Basso 2015-03-31 18:31:14 UTC
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
Comment 1 Gael Guennebaud 2015-03-31 22:49:42 UTC
Confirmed with bith 3.2 and devel branches. The problem is that Eigen wrongly assumes that the rhs can be read through aligned loads.
Comment 3 Nobody 2019-12-04 14:26:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/987.

Note You need to log in before you can comment on or make changes to this bug.