bugGNU Octave - Bugs: bug #42825, Memory corruption in sparse matrix...


bug #42825: Memory corruption in sparse matrix operation

Submitted by:  None
Submitted on:  Tue 22 Jul 2014 10:57:40 AM UTC  
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: ConfirmedAssigned to: None
Originator Name: Chong YidongOriginator Email: -unavailable-
Open/Closed: OpenRelease: 3.8.1
Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Wed 23 Jul 2014 11:54:37 PM UTC, comment #2:

My guess is that this has something to do with the auto-conversion of the array from SparseMatrix to SparseComplexMatrix when there are outstanding free values allocated by spalloc.

The code works if there are no such values: spalloc called with nnz < 3 for third argument. It also works if the first assignment is first made to a complex value, and then to a real value.

Rik <rik5>
Project Administrator
Tue 22 Jul 2014 09:53:18 PM UTC, comment #1:

Confirmed with a recent tip (ed3cb9f81145). This is a regression as the code worked in version 3.2.4 and fails in 3.4.3 and subsequent versions.

Rik <rik5>
Project Administrator
Tue 22 Jul 2014 10:57:40 AM UTC, original submission:

Run the following:

octave:1> H = spalloc(800,800,10);
octave:2> H(1,401) = 1;
octave:3> H(1,40) = 1i;
octave:4> H(2,21) = 1i;
octave:5> H(1,401)
ans = Compressed Column Sparse (rows = 1, cols = 1, nnz = 1 [100%])

(1, 1) -> 0 + 1i

Expected result: H(1,401) should be 1.

Observed in Octave 3.8.1 as well as latest hg version (4.1.0+, 22-Jul-2014).



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 15 Nov 2014 11:41:05 PM UTCmtmillerCategoryNone=>Octave Function
    Tue 22 Jul 2014 09:53:18 PM UTCrik5Item GroupIncorrect Result=>Regression

    Back to the top

    Powered by Savane 3.1-cleanup