New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1172 - GCC UBSAN error of sparse Cholesky decomposition
Summary: GCC UBSAN error of sparse Cholesky decomposition
Alias: None
Product: Eigen
Classification: Unclassified
Component: Sparse (show other bugs)
Version: 3.2
Hardware: x86 - 64-bit Linux
: Normal Crash
Assignee: Nobody
Depends on:
Reported: 2016-02-24 18:03 UTC by Yixuan Qiu
Modified: 2016-02-27 15:18 UTC (History)
2 users (show)


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'


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. (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.