Re: [eigen] memory error

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


This has been fixed a year ago:

changeset:   8341:d9b6de77bb87
user:        Gael Guennebaud <g.gael@xxxxxxx>
date:        Fri Feb 19 22:58:52 2016 +0100
summary:     Bug 1170: skip calls to memcpy/memmove for empty imput.

and the fix is part of 3.2..9 and 3.3.0.

gael

On Sun, Feb 19, 2017 at 8:28 AM, Mathieu Dutour <mathieu.dutour@xxxxxxxxx> wrote:
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



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/