This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 222 - jacobisvd_7 unit test hits data-not-aligned assertion when EIGEN_DEFAULT_TO_ROW_MAJOR is defined
Summary: jacobisvd_7 unit test hits data-not-aligned assertion when EIGEN_DEFAULT_TO_R...
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Tests (show other bugs)
Version: 3.0
Hardware: x86 - SSE Linux
: --- Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-14 16:31 UTC by Jitse Niesen
Modified: 2019-12-04 10:30 UTC (History)
3 users (show)



Attachments
Minimal test example (207 bytes, text/plain)
2011-03-14 16:31 UTC, Jitse Niesen
no flags Details
Backtrace produced by GDB (2.45 KB, text/plain)
2011-03-14 16:32 UTC, Jitse Niesen
no flags Details

Description Jitse Niesen 2011-03-14 16:31:15 UTC
Created attachment 140 [details]
Minimal test example

On my computer (gcc 4.3, 32 bits) the jacobisvd_7 unit test fails on a data-not-aligned assertion if compiling the tests in Release mode with SSE2 enabled and EIGEN_DEFAULT_TO_ROW_MAJOR defined.

Side note: Probably not serious enough to delay RC1 for.

See http://eigen.tuxfamily.org/CDash/testDetails.php?test=266017&build=5472 for the precise message.

I did not yet have time to analyze it fully, but here are some results.

I boiled down the test to the attached minimal test example. Compile with -msse2 -O2 and run to trigger the failure. The #define EIGEN_STACK_ALLOCATION_LIMIT 0 is copied from the jacobisvd_7 test and necessary to trigger the bug. The size of 49 is the smallest size for which it goes wrong. The significance of the number is probably that it is one more than 48, the block size for the Householder.

I'll also attach a stack trace shortly. The assertion is triggered in Product.h:442 because actualDestPtr is not aligned. This pointer is defined in Product.h:434. At that point, dest.size() is 0, so ei_aligned_stack_new() calls alloca(). However, alloca(0) does not return an aligned pointer.
Comment 1 Jitse Niesen 2011-03-14 16:32:54 UTC
Created attachment 141 [details]
Backtrace produced by GDB
Comment 2 Christoph Hertzberg 2014-03-20 23:03:50 UTC
I guess this has long been fixed.
Comment 3 Jitse Niesen 2014-03-26 15:07:38 UTC
I can still reproduce the bug with the current dev version and GCC 4.8.2 (in CMake, set EIGEN_TEST_32BIT to ON and EIGEN_TEST_CUSTOM_CXX_FLAGS to -DEIGEN_DEFAULT_TO_ROW_MAJOR).
Comment 4 Christoph Hertzberg 2014-03-26 16:29:10 UTC
Sorry for closing this, prematurely. I actually only tested EIGEN_DEFAULT_TO_ROW_MAJOR on a 64bit platform, but never on 32bit.

I can reproduce the error with g++ 4.7.1 on Linux 32bit, but strangely not if compiling your reduced example with -O0.

Generally, the jacobisvd implementations looks inefficient for with EDTRM, because it allocates a Matrix<Scalar, 48, 48> and accesses that column-by-column.
Comment 5 Christoph Hertzberg 2014-03-26 17:52:31 UTC
I worked around the issue, by forcing the internal temporary matrix to be column-major:
https://bitbucket.org/eigen/eigen/commits/d17bff2
https://bitbucket.org/eigen/eigen/commits/5cb7a2c

Actually, it would still be interesting to find the actual cause of the error.
Comment 6 Nobody 2019-12-04 10:30:54 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/222.

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