This bugzilla service is closed. All entries have been migrated to
Bug 369 - Improperly aligned Quaternion class
Summary: Improperly aligned Quaternion class
Alias: None
Product: Eigen
Classification: Unclassified
Component: Geometry (show other bugs)
Version: 3.0
Hardware: All Windows
: --- major
Assignee: Nobody
: 378 (view as bug list)
Depends on:
Reported: 2011-10-27 14:42 UTC by fsck
Modified: 2019-12-04 11:14 UTC (History)
4 users (show)


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)) };
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'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:

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