New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1311 - Segfault on Scalar * (Matrix * Vector)
Segfault on Scalar * (Matrix * Vector)
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - vectorization
3.3 (current stable)
All All
: Highest Crash
Assigned To: Nobody
:
: 1321 (view as bug list)
Depends on:
Blocks: 3.3
  Show dependency treegraph
 
Reported: 2016-09-25 19:41 UTC by Gilles Daviet
Modified: 2016-10-12 14:54 UTC (History)
5 users (show)



Attachments
Backtrace (11.13 KB, text/plain)
2016-09-25 19:41 UTC, Gilles Daviet
no flags Details

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

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