Signed/unsigned integer comparison
Created by: honnibal
Thanks for your work on this library.
I'm trying to compile Paddle on a platform you don't support yet, Ubuntu 16.04. I think this has a different compiler from Ubuntu 14.04. I'm seeing compiler errors from sign/unsigned comparison. I think newer GCC fixed a bug that ignored these errors in template expansions.
There are at least two errors in the file https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/math/BaseMatrix.cu , in the applyRow
and applyCol
functions. The numRow
and numCol
variables are declared as int
, and then compared against unsigned types.
There is a similar problem in math/Vector.cpp
, I think in the toOneHotSparseMatrix
method.
I think policy of signed and unsigned type usage in the math module might need review. I see that the dimension members are mostly defined as size_t
. However, various local variables are of type int
, and some of the methods take int
arguments.
You might also check other code that calls the CHECK_EQ
, CHECK_NE
, CHECK_LT
, CHECK_GT
macros in the Logging
module. I think the signed/unsigned comparison error currently seems like a very easy error to make.