octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63682] mat2cell returns incorrect value when


From: Rik
Subject: [Octave-bug-tracker] [bug #63682] mat2cell returns incorrect value when only one output dimensions is specified and input is N-D array
Date: Mon, 20 Feb 2023 00:18:20 -0500 (EST)

Follow-up Comment #18, bug #63682 (project octave):

I checked in a bigger change which appears to fix the problem (passes ASAN
testing).  See http://hg.savannah.gnu.org/hgweb/octave/rev/e27744dfb13a.  The
problem seems to have been that the for loop that assigned values to the
output called increment_index() for every loop iteration.  This makes sense
for each iteration except the last one.  On the last one, the indexing
operation has taken place and all values have been calculated.  The loop body
will not be executed again and so there is no need to increment the index. 
And if you do increment the index then it overflows.  This bug has been hidden
in Octave for a very long time.  I also added as many comments as I could
because this was very confusing code.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63682>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]