|
From: | Rik |
Subject: | [Octave-bug-tracker] [bug #60101] symbfact crashes for dense matrices |
Date: | Tue, 23 Feb 2021 00:20:36 -0500 (EST) |
User-agent: | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36 |
Follow-up Comment #9, bug #60101 (project octave): I've found the problem. The code in symbfact.cc at the start of the function is const SparseMatrix a = args(0).sparse_matrix_value (); if (args(0).isreal ()) { //const SparseMatrix a = args(0).sparse_matrix_value (); A->nrow = a.rows (); A->ncol = a.cols (); A->p = a.cidx (); A->i = a.ridx (); A->nzmax = a.nnz (); A->xtype = CHOLMOD_REAL; if (a.rows () > 0 && a.cols () > 0) A->x = a.data (); } else if (args(0).iscomplex ()) { const SparseComplexMatrix a = args(0).sparse_complex_matrix_value (); A->nrow = a.rows (); A->ncol = a.cols (); A->p = a.cidx (); A->i = a.ridx (); A->nzmax = a.nnz (); A->xtype = CHOLMOD_COMPLEX; if (a.rows () > 0 && a.cols () > 0) A->x = a.data (); } A temporary variable 'a' is declared inside a block and then used to initialize the cholmod_sparse matrix A. But when execution proceeds out of the block the variable goes out of scope and can be reclaimed by a runtime garbage collector. I made the simple change above of declaring the variable 'a' outside of a block so it is available and that stops the segfaults. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?60101> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |