diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-02-05 21:38:16 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-02-05 21:38:16 +0100 |
commit | e8e1d504d6cbeb47c33169a36c052aa21bea32ee (patch) | |
tree | f5d74c607135d1a1c7ae554f1435eee5e4ae7307 /Eigen/src/Core/util/Memory.h | |
parent | 62a1c911cd1fca97c381ac5cb21d0345934148a4 (diff) |
Add an explicit assersion on the alignment of the pointer returned by std::malloc
Diffstat (limited to 'Eigen/src/Core/util/Memory.h')
-rw-r--r-- | Eigen/src/Core/util/Memory.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 84fb0516c..01513a59e 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -157,6 +157,9 @@ EIGEN_DEVICE_FUNC inline void* aligned_malloc(size_t size) void *result; #if (EIGEN_DEFAULT_ALIGN_BYTES==0) || EIGEN_MALLOC_ALREADY_ALIGNED result = std::malloc(size); + #if EIGEN_DEFAULT_ALIGN_BYTES==16 + eigen_assert((size<16 || (std::size_t(result)%16)==0) && "System's malloc returned an unaligned pointer. Compile with EIGEN_MALLOC_ALREADY_ALIGNED=0 to fallback to handmade alignd memory allocator."); + #endif #else result = handmade_aligned_malloc(size); #endif |