New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!

Bug 1311

Summary: Segfault on Scalar * (Matrix * Vector)
Product: Eigen Reporter: Gilles Daviet <gdaviet>
Component: Core - vectorizationAssignee: Nobody <eigen.nobody>
Severity: Crash CC: Arturo.Laurenzi, chtz, gael.guennebaud, jacob.benoit.1, markos
Priority: Highest    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 558    
Description Flags
Backtrace none

Description Gilles Daviet 2016-09-25 19:41:17 UTC
Created attachment 739 [details]

I might be doing something wrong, but since this used to work 
without any issue, here is a minimal example segfaulting on 3.3-rc1.

> cat 

#include <Eigen/Core>

int main() {
	Eigen::Matrix< double, 3, 2 > block ;
	block.setOnes() ;

	Eigen::Vector2d rhs = Eigen::Vector2d::Zero() ;

	Eigen::Vector3d res = 1. * ( block * rhs )  ;

	return 0 ;

> g++-5 -I eigen-33r1/ -o test && ./test 
Segmentation fault
> g++-5 -I eigen-33b2 -o test && ./test 

Happens with recent versions of gcc and clang
> g++-6 -I eigen-33r1/ -o test && ./test 
Segmentation fault
> clang++ -I eigen-33r1/ -o test && ./test 
Segmentation fault

..but can disappear once optimizations are enabled
> clang++ -O3 -I eigen-eigen-e35a38ad89fe/ -o test && ./test

Regression seems to have been introduced in commit  e35a38a

> g++-5 -I eigen-eigen-e35a38ad89fe/ -o test && ./test 
Segmentation fault
> g++-5 -I eigen-eigen-0b62bc896f80/ -o test && ./test 

Reverting this patch on 3.3-rc1 fixed the issue on my side.
Comment 1 Christoph Hertzberg 2016-09-26 11:11:33 UTC
I can confirm this. I assume it is on all platforms that support vectorization.
And you indeed found the offending commit.
Comment 2 Gael Guennebaud 2016-09-26 21:56:22 UTC
Thank you for finding this issue. Fixed:

(the "offending" commit was only revealing a shortcoming elsewhere).
Comment 3 Gael Guennebaud 2016-10-12 14:54:14 UTC
*** Bug 1321 has been marked as a duplicate of this bug. ***