diff options
-rw-r--r-- | Eigen/src/Core/MapBase.h | 3 | ||||
-rw-r--r-- | test/dynalloc.cpp | 6 | ||||
-rw-r--r-- | test/mapped_matrix.cpp | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h index 75a80daaa..afa47540e 100644 --- a/Eigen/src/Core/MapBase.h +++ b/Eigen/src/Core/MapBase.h @@ -165,7 +165,8 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors> void checkSanity() const { #if EIGEN_MAX_ALIGN_BYTES>0 - eigen_assert(((size_t(m_data) % EIGEN_PLAIN_ENUM_MAX(1,internal::traits<Derived>::Alignment)) == 0) && "data is not aligned"); + eigen_assert(( ((size_t(m_data) % EIGEN_PLAIN_ENUM_MAX(1,internal::traits<Derived>::Alignment)) == 0) + || (cols() * rows() * innerStride() * sizeof(Scalar)) < internal::traits<Derived>::Alignment ) && "data is not aligned"); #endif } diff --git a/test/dynalloc.cpp b/test/dynalloc.cpp index 6f22e1ab4..5f587007c 100644 --- a/test/dynalloc.cpp +++ b/test/dynalloc.cpp @@ -31,7 +31,7 @@ void check_handmade_aligned_malloc() void check_aligned_malloc() { - for(int i = 1; i < 1000; i++) + for(int i = ALIGNMENT; i < 1000; i++) { char *p = (char*)internal::aligned_malloc(i); VERIFY(size_t(p)%ALIGNMENT==0); @@ -43,7 +43,7 @@ void check_aligned_malloc() void check_aligned_new() { - for(int i = 1; i < 1000; i++) + for(int i = ALIGNMENT; i < 1000; i++) { float *p = internal::aligned_new<float>(i); VERIFY(size_t(p)%ALIGNMENT==0); @@ -55,7 +55,7 @@ void check_aligned_new() void check_aligned_stack_alloc() { - for(int i = 1; i < 400; i++) + for(int i = ALIGNMENT; i < 400; i++) { ei_declare_aligned_stack_constructed_variable(float,p,i,0); VERIFY(size_t(p)%ALIGNMENT==0); diff --git a/test/mapped_matrix.cpp b/test/mapped_matrix.cpp index 7c7099792..88653e887 100644 --- a/test/mapped_matrix.cpp +++ b/test/mapped_matrix.cpp @@ -40,7 +40,7 @@ template<typename VectorType> void map_class_vector(const VectorType& m) VERIFY_IS_EQUAL(ma1, ma3); VERIFY_IS_EQUAL(ma1, ma4); #ifdef EIGEN_VECTORIZE - if(internal::packet_traits<Scalar>::Vectorizable) + if(internal::packet_traits<Scalar>::Vectorizable && size>=AlignedMax) VERIFY_RAISES_ASSERT((Map<VectorType,AlignedMax>(array3unaligned, size))) #endif |