Re: [eigen] Compile warnings 3.2.0-beta1: Implicit conversion loses integer precision

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


Hello Daniel,

> with clang++ (Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)) I get a few warnings
> about implicitly truncating integers, e.g.

Clang generates these warnings in a lot of places in Eigen. There is an outstanding bug on the issue here:
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=397
Which is now over a year old. I suspect that not all the cases of this issue have been found either.

> eigen-3.2.0/Eigen/src/Core/Assign.h:288:25: warning: implicit conversion loses integer precision: 'Index' (aka 'long') to 'int' [-Wshorten-64-to-32]
>        ::run(dst, src, outer);
>                        ^~~~~
> => no idea about this one.
I have the same warning being generated. I am pretty sure it is due to line 158 in Assign.h. Currently it is:

  static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, int outer)

However, fixing it is non-trivial. Changing the type of outer to either Derived1::Index or Derived2::Index leads to the same issue on line 161 of Assign.h when assign_DefaultTraversal_InnerUnrolling recurses to itself, and I have no idea how to fix that. There is also the minor problem that "Index" within this function is actually a variable and so not available as a typename.

As a general question - why was the decision taken to to define the "Index" type on a per-class basis, instead of some kind of global typedef for Eigen?

Regards,
Toby



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