New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1172 - GCC UBSAN error of sparse Cholesky decomposition
GCC UBSAN error of sparse Cholesky decomposition
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Sparse
3.2
x86 - 64-bit Linux
: Normal Crash
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-24 18:03 UTC by Yixuan Qiu
Modified: 2016-02-27 15:18 UTC (History)
2 users (show)



Attachments

Description Yixuan Qiu 2016-02-24 18:03:30 UTC
Hi All,

GCC UBSAN reports runtime errors on sparse Cholesky decomposition.
Below is a minimal example:

========================================
#include <Eigen/Sparse>

int main()
{
    Eigen::SparseMatrix<double> mat(10, 10);

    for(int i = 0; i < mat.rows(); i++)
        mat.insert(i, i) = 1.0;

    Eigen::SimplicialLDLT< Eigen::SparseMatrix<double> > ll(mat);

    return 0;
}

========================================

Compiling this code with "g++ -g -fsanitize=undefined,address -I. test.cpp" and running it gives

Eigen/src/SparseCore/CompressedStorage.h:108:55: runtime error: reference binding to null pointer of type 'Index'
Eigen/src/SparseCore/CompressedStorage.h:105:55: runtime error: reference binding to null pointer of type 'Scalar'


Thanks.


OS: Fedora 23 64-bit
Eigen: most recent 3.2 branch (also occurs in 3.3 branch)
GCC: g++ (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
Comment 1 Gael Guennebaud 2016-02-27 14:10:06 UTC
Thank you for the report. 

https://bitbucket.org/eigen/eigen/commits/cb84354748ba/
https://bitbucket.org/eigen/eigen/commits/d1c22058362b/ (3.2)
Summary:     Bug 1172: make valuePtr and innderIndexPtr properly return null for empty matrices.
Comment 2 Yixuan Qiu 2016-02-27 15:18:23 UTC
Thanks for the quick fix!

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