[eigen] Fix for invalid integer constant

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


The attached patch fixes the following compile error, which happens when compiling Eigen with some C++11 warnings turned on in Clang.

./third_party/eigen3/Eigen/src/LU/arch/Inverse_SSE.h:58:60: error: constant _expression_ evaluates to 2147483648 which cannot be narrowed to type 'int' in C++11 [-Werror,-Wc++11-narrowing]
    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
                                                           ^~~~~~~~~~
./third_party/eigen3/Eigen/src/LU/arch/Inverse_SSE.h:58:60: note: override this message by inserting an explicit cast
    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
                                                           ^~~~~~~~~~
                                                           static_cas)<int>(
./third_party/eigen3/Eigen/src/LU/arch/Inverse_SSE.h:58:72: error: constant _expression_ evaluates to 2147483648 which cannot be narrowed to type 'int' in C++11 [-Werror,-Wc++11-narrowing]
    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
                                                                       ^~~~~~~~~~
./third_party/eigen3/Eigen/src/LU/arch/Inverse_SSE.h:58:72: note: override this message by inserting an explicit cast
    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
                                                                       ^~~~~~~~~~
                                                                       static_cas)<int>(
./third_party/eigen3/Eigen/src/LU/arch/Inverse_SSE.h:58:60: error: constant _expression_ evaluates to 2147483648 which cannot be narrowed to type 'int' in C++11 [-Werror,-Wc++11-narrowing]
    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
                                                           ^~~~~~~~~~
./third_party/eigen3/Eigen/src/LU/arch/Inverse_SSE.h:58:60: note: override this message by inserting an explicit cast
    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
                                                           ^~~~~~~~~~
                                                           static_cas)<int>(
./third_party/eigen3/Eigen/src/LU/arch/Inverse_SSE.h:58:72: error: constant _expression_ evaluates to 2147483648 which cannot be narrowed to type 'int' in C++11 [-Werror,-Wc++11-narrowing]
    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
                                                                       ^~~~~~~~~~
./third_party/eigen3/Eigen/src/LU/arch/Inverse_SSE.h:58:72: note: override this message by inserting an explicit cast
    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
                                                                       ^~~~~~~~~~
                                                                       static_cas)<int>(

Let me know if more details are needed.

Keir
# HG changeset patch
# User Keir Mierle <mierle@xxxxxxxxx>
# Date 1325834109 28800
# Branch 3.0
# Node ID 9f1e5198da7fa08f82e297949d85b24760571f64
# Parent  7a3491a304e43c4a271d2b7d7d36e89930061dcf
Fix out-of-range int constant in 4x4 inverse.

diff -r 7a3491a304e4 -r 9f1e5198da7f Eigen/src/LU/arch/Inverse_SSE.h
--- a/Eigen/src/LU/arch/Inverse_SSE.h	Fri Dec 23 22:39:32 2011 +0100
+++ b/Eigen/src/LU/arch/Inverse_SSE.h	Thu Jan 05 23:15:09 2012 -0800
@@ -55,7 +55,7 @@
   
   static void run(const MatrixType& matrix, ResultType& result)
   {
-    EIGEN_ALIGN16 const  int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
+    EIGEN_ALIGN16 const unsigned int _Sign_PNNP[4] = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 };
 
     // Load the full matrix into registers
     __m128 _L1 = matrix.template packet<MatrixAlignment>( 0);


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