Bug 678 - FullPivHouseholderQR causes several valgrind warnings
FullPivHouseholderQR causes several valgrind warnings
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Householder
3.2
x86 - 32-bit Linux
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-13 18:31 UTC by Markus
Modified: 2013-10-29 18:04 UTC (History)
1 user (show)



Attachments

Description Markus 2013-10-13 18:31:48 UTC
Hi,

The following MWE triggers several "Use of uninitialised value of size 4" and "Conditional jump or move depends on uninitialised value(s)" warnings. Using Eigen 3.2.0 (latest stable) and gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3. It seems that they are cause by rowsTranspositions() inside the FullPivHouseholderQR. 


int main(int argc, char **argv)
{
    Eigen::Matrix<float,5,3> X;
    X<<0.8147,0.9134,0.2785, 0.9058,0.6324,0.5469, 0.1270,0.0975,1.0, 0.2341,0.6631,0.0544, 0.4214,0.8623,0.5623;

    // Center the variables
    Eigen::MatrixXf Xnorm = (X.rowwise() - X.colwise().sum() / static_cast<float>(X.rows()));

    // Factor the inputs
    Eigen::FullPivHouseholderQR<Eigen::MatrixXf> qr1(Xnorm);
    Eigen::MatrixXf Q1 = qr1.matrixQ();
    Eigen::MatrixXf T1 = qr1.matrixQR().triangularView<Eigen::Upper>();

    std::cout<<Xnorm<<std::endl;
    std::cout<<Q1<<std::endl<<T1<<std::endl<<qr1.rowsTranspositions()<<std::endl;

    return 0;
}

==7300== Conditional jump or move depends on uninitialised value(s)
==7300==    at 0x40E31BD: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40E3502: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40EEEBB: std::ostream& std::ostream::_M_insert<long>(long) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40EF042: std::ostream::operator<<(int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x81110CC: std::ostream& Eigen::operator<< <Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::ostream&, Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&) (IO.h:244)
==7300==    by 0x810F85D: main (main.cpp:48)
==7300== 
==7300== Use of uninitialised value of size 4
==7300==    at 0x40E2C53: ??? (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40E31F0: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40E3502: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40EEEBB: std::ostream& std::ostream::_M_insert<long>(long) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40EF042: std::ostream::operator<<(int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x81110CC: std::ostream& Eigen::operator<< <Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::ostream&, Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&) (IO.h:244)
==7300==    by 0x810F85D: main (main.cpp:48)
==7300== 
==7300== Conditional jump or move depends on uninitialised value(s)
==7300==    at 0x40E2C5C: ??? (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40E31F0: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40E3502: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40EEEBB: std::ostream& std::ostream::_M_insert<long>(long) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40EF042: std::ostream::operator<<(int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x81110CC: std::ostream& Eigen::operator<< <Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::ostream&, Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&) (IO.h:244)
==7300==    by 0x810F85D: main (main.cpp:48)
==7300== 
==7300== Conditional jump or move depends on uninitialised value(s)
==7300==    at 0x40E321A: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40E3502: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40EEEBB: std::ostream& std::ostream::_M_insert<long>(long) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x40EF042: std::ostream::operator<<(int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==7300==    by 0x81110CC: std::ostream& Eigen::operator<< <Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::ostream&, Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&) (IO.h:244)
==7300==    by 0x810F85D: main (main.cpp:48)
==7300== 
0
0
==7300== 
==7300== HEAP SUMMARY:
==7300==     in use at exit: 0 bytes in 0 blocks
==7300==   total heap usage: 160 allocs, 160 frees, 25,381 bytes allocated
==7300== 
==7300== All heap blocks were freed -- no leaks are possible
==7300== 
==7300== For counts of detected and suppressed errors, rerun with: -v
==7300== Use --track-origins=yes to see where uninitialised values come from
==7300== ERROR SUMMARY: 8 errors from 4 contexts (suppressed: 0 from 0)
Comment 1 Gael Guennebaud 2013-10-29 18:04:29 UTC
Thanks, this bug never showed up because the uninitialized entries were never accessed.

https://bitbucket.org/eigen/eigen/commits/23694613ae7e/
Changeset:   23694613ae7e
User:        ggael
Date:        2013-10-29 18:02:18
Summary:     Fix bug 678: vectors of row and columns transpositions were not properly resized in FullPivQR
Affected #:  1 file

https://bitbucket.org/eigen/eigen/commits/dac523730f46/
Changeset:   dac523730f46
Branch:      3.2
User:        ggael
Date:        2013-10-29 18:02:18
Summary:     Fix bug 678: vectors of row and columns transpositions were not properly resized in FullPivQR
(grafted from 23694613ae7ec72e969ae2f282cd84f5f9655d56)

https://bitbucket.org/eigen/eigen/commits/de034016dd3b/
Changeset:   de034016dd3b
Branch:      3.1
User:        ggael
Date:        2013-10-29 18:02:18
Summary:     Fix bug 678: vectors of row and columns transpositions were not properly resized in FullPivQR
(grafted from 23694613ae7ec72e969ae2f282cd84f5f9655d56)

Note You need to log in before you can comment on or make changes to this bug.