This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 993 - Stack overflow when passing matrix inverse as function argument
Summary: Stack overflow when passing matrix inverse as function argument
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: LU (show other bugs)
Version: 3.2
Hardware: All All
: Highest Crash
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-09 16:47 UTC by Sergiu Deitsch
Modified: 2019-12-04 14:28 UTC (History)
1 user (show)



Attachments
Test case (226 bytes, text/plain)
2015-04-09 16:50 UTC, Sergiu Deitsch
no flags Details

Description Sergiu Deitsch 2015-04-09 16:47:41 UTC
The following code causes a stack overflow in DenseCoeffsBase.h line 212 (as for changeset eac2061f58b1).

> #include <Eigen/Core>
> #include <Eigen/LU>
> 
> template<class Derived>
> void foo(const Eigen::MatrixBase<Derived>& value)
> {
>     Eigen::Matrix2d tmp = value; // boom
> }
> 
> int main()
> {
>     foo(Eigen::Matrix2d::Identity().inverse());
> }

This does not happen, if I call .eval().

I'm using Visual Studio 12 2013.
Comment 1 Sergiu Deitsch 2015-04-09 16:50:32 UTC
Created attachment 562 [details]
Test case
Comment 2 Christoph Hertzberg 2015-04-09 19:23:56 UTC
The problem is that .inverse() returns a ReturnByValue but the initialization above tries to copy the expression packet-wise.
I fixed it locally. I'll commit it after running the testsuite.
Comment 3 Christoph Hertzberg 2015-04-09 20:34:44 UTC
Fixed:
https://bitbucket.org/eigen/eigen/commits/510021a
Comment 4 Sergiu Deitsch 2015-04-09 23:54:40 UTC
Great. Thanks!
Comment 5 Nobody 2019-12-04 14:28:58 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/993.

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