Memory Not Properly Aligned (Incorrect Assumptions About std::malloc)
Submitted by ens..@..er.com
Assigned to Nobody
Link to original bugzilla bug (#761)
Version: 3.2
Description
We have experienced crashes with Eigen 3.2.1 (and as far back as Eigen 3.1.2) under 64-bit OS variants, including Windows 7 and 8 (VS 2010 and VS 2012) and Red Hat Enterprise Linux 6.5 (glibc-2.12, standard GCC 4.4, devtoolset-1.1/GCC 4.7, and devtoolset-2/GCC 4.8). We are using Intel Parallel Studio XE 2013 SP1 on all platforms. The header file Eigen/Core/util/Memory.h incorrectly asserts that std::malloc/realloc/etc under 64-bit Windows and 64-bit Linux is always properly aligned. This simply is not true, as can be demonstrated by the supplied patch. The same assumption is make about Apple, but we have not verified this.
If you replace Eigen/Core/util/Memory.h with the version provided, or if you apply the provided patch, you will see warnings about std::malloc not being aligned. Clearly, the only solution on these systems is to always call posix_memalign (Linux) or _aligned_malloc (Windows).