This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 581

Summary: blueNorm() implementation produces an interesting warning from clang++
Product: Eigen Reporter: Kyle M. Tarplee <kyle.tarplee>
Component: GeometryAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Unknown CC: gael.guennebaud, hauke.heibel, jacob.benoit.1
Priority: Normal    
Version: 3.2   
Hardware: x86 - 64-bit   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 387    

Description Kyle M. Tarplee 2013-04-08 23:13:14 UTC
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();
Comment 1 Kyle M. Tarplee 2013-04-08 23:13:46 UTC
The code for 3.2 also has this problem.
Comment 2 Gael Guennebaud 2013-04-09 09:28:06 UTC
Indeed, that might look scary, but fortunately this piece of code was actually useless, and that's why this mistake did not show up in our unit test. Thanks for the report.

https://bitbucket.org/eigen/eigen/commits/72a7ce1bca6d/
Changeset:   72a7ce1bca6d
User:        ggael
Date:        2013-04-09 09:23:40
Summary:     Fix bug 581: remove useless piece of code is blueNorm

https://bitbucket.org/eigen/eigen/commits/83ccf6713af3/
Changeset:   83ccf6713af3
Branch:      3.1
User:        ggael
Date:        2013-04-09 09:23:40
Summary:     Fix bug 581: remove useless piece of code is blueNorm
(transplanted from 72a7ce1bca6d88fb4bc788be628925bebdf0e037)
Comment 3 Nobody 2019-12-04 12:14:10 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/581.