New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org 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>
Status: RESOLVED FIXED    
Severity: Crash CC: Arturo.Laurenzi, chtz, gael.guennebaud, jacob.benoit.1, markos
Priority: Highest    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 558    
Attachments:
Description Flags
Backtrace none

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

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 test.cc 

#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/  test.cc -o test && ./test 
Segmentation fault
> g++-5 -I eigen-33b2  test.cc -o test && ./test 

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

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


Regression seems to have been introduced in commit  e35a38a

> g++-5 -I eigen-eigen-e35a38ad89fe/  test.cc -o test && ./test 
Segmentation fault
> g++-5 -I eigen-eigen-0b62bc896f80/  test.cc -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:
https://bitbucket.org/eigen/eigen/commits/2f24280cf59a/

(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. ***