http://eigen.tuxfamily.org/dox/TopicUnalignedArrayAssert.html#c1
If you have code like this,
class Foo
{
//...
//...
};
//...
Foo *foo = new Foo;
then you need to read this separate page: Structures Having Eigen Members.
Note that here, Eigen::Vector2d is only used as an example, more generally the issue arises for all fixed-size vectorizable Eigen types.
If you use STL Containers such as std::vector, std::map, ..., with Eigen objects, or with classes containingEigen objects, like this,
std::vector<Eigen::Matrix2f> my_vector;
struct my_class { ... Eigen::Matrix2f m; ... };
std::map<int, my_class> my_map;
then you need to read this separate page: Using STL Containers with Eigen.
Note that here, Eigen::Matrix2f is only used as an example, more generally the issue arises for all fixed-size vectorizable Eigen types and structures having such Eigen objects as member.
If some function in your code is getting an Eigen object passed by value, like this,
void func(Eigen::Vector4d v);
then you need to read this separate page: Passing Eigen objects by value to functions.
Note that here, Eigen::Vector4d is only used as an example, more generally the issue arises for all fixed-size vectorizable Eigen types.
This is a must-read for people using GCC on Windows (like MinGW or TDM-GCC). If you have this assertion failure in an innocent function declaring a local variable like this:
void foo()
{
//...
}
then you need to read this separate page: Compiler making a wrong assumption on stack alignment.
Note that here, Eigen::Quaternionf is only used as an example, more generally the issue arises for all fixed-size vectorizable Eigen types.
fixed-size vectorizable Eigen objects must absolutely be created at 16-byte-aligned locations, otherwise SIMD instructions adressing them will crash.
Eigen normally takes care of these alignment issues for you, by setting an alignment attribute on them and by overloading their "operator new".
However there are a few corner cases where these alignment settings get overridden: they are the possible causes for this assertion.
Two possibilities: