Skip to content

blueNorm() implementation produces an interesting warning from clang++

Submitted by Kyle M. Tarplee

Assigned to Nobody

Link to original bugzilla bug (#581)
Version: 3.2
Platform: x86 - 64-bit

Description

Clang issues a warning about implicit conversion from long to int in the blueNorm implementation. The scary part about this warning is that the code is trying to find the largest int but ends up with -1 due to the implicit case.

This can be easily fixed by replacing the use of int on lines 48 and 79 with Index (which for my 64 bit mac is 64 bit).

In file included from /opt/local/include/eigen3/Eigen/Dense:1:
In file included from /opt/local/include/eigen3/Eigen/Core:294:
/opt/local/include/eigen3/Eigen/src/Core/StableNorm.h:93:13: warning: implicit conversion from 'type' (aka 'long') to 'int' changes value from 9223372036854775807 to -1 [-Werror,-Wconstant-conversion]
nbig = (std::numeric_limits<Index>::max)(); // largest integer
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/eigen3/unsupported/Eigen/src/NonLinearOptimization/lmpar.h:207:18: note: in instantiation of member function 'Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >::blueNorm' requested here
dxnorm = wa2.blueNorm();

Blocking

#387 (closed)

Edited by Eigen Bugzilla