I compiled a C++ program with gcc and the options
-fsanitize=address -fsanitize=undefined
I get following while running
/home/mathieu/opt/eigen/Eigen/src/Core/util/Memory.h:580:5: runtime error: null pointer passed as argument 1, which is declared to never be null
The relevant code is
template<typename T> struct smart_copy_helper<T,true> {
EIGEN_DEVICE_FUNC static inline void run(const T* start, const T* end, T* target)
{ memcpy(target, start, std::ptrdiff_t(end)-std::ptrdiff_t(start)); }
};
The fact is that yes I have matrices which are empty. I have some struct
looking like
struct {
bool IsSpherical;
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> LON, LAT;
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> X, Y;
};
So, some arrays can be empty and some others not. But the struct is
copied.
Mathieu