This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 369

Summary: Improperly aligned Quaternion class
Product: Eigen Reporter: fsck
Component: GeometryAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: major CC: alexey.pelykh, gael.guennebaud, hauke.heibel, jacob.benoit.1
Priority: ---    
Version: 3.0   
Hardware: All   
OS: Windows   
Whiteboard:

Description fsck 2011-10-27 14:42:51 UTC
There appears to be a problem with the alignment of the Eigen::Quaternion class. The problem is that the EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT assertion is raised if a Quaternion is allocated on the heap.

Configuration: Microsoft Visual Studio 2010 Express, SSE2 architecture enabled, Eigen vectorization enabled, 32-bit build.

The problem in is produced with the following code:

return new Eigen::Quaternion< float >( a, b, c, d ); // where a,b,c,d are arbitrary values

And is caused by the regular (unaligned) new allocator being called, instead of the aligned allocator (as overloaded by EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF), and the fact that the Quaterion class apparently requires an aligned member:

Coefficients m_coeffs;

Because the unaligned allocator is called, this requirement is not met and an assertion is thrown.

The problem seens to be fixed by overloading the new operator in the Quaternion class (this may not be the best place, but it works) by adding the following to the Quaternion class (copied from Matrix):

enum { NeedsToAlign = (!(_Options&DontAlign)) };
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
Comment 1 Benoit Jacob 2011-10-31 14:25:36 UTC
Fixed in fad437303568. The problem was actually a bit worse than that. Thanks for the report.
Comment 2 Benoit Jacob 2011-10-31 15:49:06 UTC
pushed to 3.0 branch: f78e89cc992e
Comment 3 Benoit Jacob 2011-11-20 07:24:44 UTC
*** Bug 378 has been marked as a duplicate of this bug. ***
Comment 4 Nobody 2019-12-04 11:14:08 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/369.