[go: up one dir, main page]

Assertion fails in stableNorm()

Submitted by Shuntaro Yamazaki

Assigned to Nobody

Link to original bugzilla bug (#1400)

Description

$ cat a.cpp
#define EIGEN_DONT_ALIGN_STATICALLY
#include <Eigen/Core>
int main() {
Eigen::VectorXd x;
x.setRandom(2);
return (x + x).stableNorm();
}
$ clang++ -I. a.cpp
$ ./a.out
a.out: ./Eigen/src/Core/MapBase.h:191: void Eigen::MapBase<Eigen::Ref<const Eigen::Matrix<double, -1, 1, 0, 4096, 1>, 16, Eigen::InnerStride<1> >, 0>::checkSanity(typename internal::enable_if<(internal::traits<T>::Alignment > 0), void *>::type) const [Derived = Eigen::Ref<const Eigen::Matrix<double, -1, 1, 0, 4096, 1>, 16, Eigen::InnerStride<1> >, Level = 0, T = Eigen::Ref<const Eigen::Matrix<double, -1, 1, 0, 4096, 1>, 16, Eigen::InnerStride<1> >]: Assertion `( ((internal::UIntPtr(m_data) % internal::traits::Alignment) == 0) || (cols() * rows() * innerStride() * sizeof(Scalar)) < internal::traits::Alignment ) && "data is not aligned"' failed.
Aborted

hg changeset: 10367:a71943b9 (HEAD as of today)
OS: ubuntu 14.04 64bit
Compiler: Clang 3.7.1

The code is no problem if EIGEN_DONT_ALIGN_STATICALLY is undefined or the size of 'x' is 1. It causes SegFault with debug build. This pattern appears (and fails) in NonLinearOptimization/LevenbergMarquardt.h in unsupported.

Best regards,
Shuntaro

Edited by Eigen Bugzilla