bugGNU Octave - Bugs: bug #39789, Error while indexing certain cell...


bug #39789: Error while indexing certain cell expressions

Submitted by:  None
Submitted on:  Thu Aug 15 08:24:47 2013  
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Alexander MamonovOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.4
Operating System: Microsoft Windows

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


Mon Jan 18 17:03:01 2016, comment #5:

@Lachlan: I checked in your fix for indexing cell expressions here (http://hg.savannah.gnu.org/hgweb/octave/rev/99d373870017). I benchmarked before/after and I couldn't detect a performance difference. One thing I did was add regression tests for this bug and bug #35841 to index.tst so that we don't accidentally re-introduce this bug if we optimize things in the future.

Rik <rik5>
Project Administrator
Wed Dec 16 01:18:23 2015, comment #4:

It is even easier to resolve, although I'm not sure if the resolution is correct :)

For some reason, the function

Array<T>::index (const Array<idx_vector>& ia, bool resize_ok, const T& rfv) const

had two checks that the dimension of ia matches that of this. First, it correctly expands trailing singletons, but in the second check it doesn't.

My current work-around is to do the second test only if a resize occurs, but since I'm not sure why the test is needed at all, that may not be the right response.

This also avoids the problem of bug #35841 directly, and so the attached changeset backs that fix out (while keeping the changes to tests).

(file #35756)

Lachlan Andrew <lachlan>
Project Member
Thu Nov 26 17:42:03 2015, comment #3:

@Lachlan: Adding you to the CC list for this bug about cell indexing with trailing singleton dimensions. This looks awfully similar to bug #35841 which dealt with the assignment to structs with trailing singleton dimensions. You prepared the changeset for that here http://hg.savannah.gnu.org/hgweb/octave/rev/96163bdd2ea1. Could you take a look and see if it is equally easy to resolve?

Rik <rik5>
Project Administrator
Sun Aug 25 08:33:40 2013, comment #2:

Looks like the issue is with octave failing to allow the second level of indexing in this case. In matlab:
in octave:

Ben Kurtz <bkurtz>
Tue Aug 20 05:08:25 2013, comment #1:

Confirmed on a recent development tip (hg id bc924baa2c4e). The issue is with how trailing dimensions are treated, and it would be useful to know how Matlab behaves for the same code input if you have access to it.

The code

does not create a 1x1x1 cell array. In Octave and Matlab trailing singleton dimensions are usually removed so this becomes

This can be checked with

Your code sample works if the cell array is truly 3-dimensional.

Rik <rik5>
Project Administrator
Thu Aug 15 08:24:47 2013, original submission:

When executing the following cell assignment

Octave gives an error:

error: a cs-list cannot be further indexed
error: assignment failed, or no method for 'cell = range'

Expected behavior is for c{1,1,1} to assume value
[1, 0; 1, 0; 1, 0; 1, 0; 1, 0]

If this bug is fixed, please add a relevant test to the test suite.



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

Attach File(s):

Attached Files
file #35756:  bug_39789.cset added by lachlan (3kB - application/octet-stream)
file #28848:  testcell111.m added by None (64B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by lachlan (Updated the item)
  • -unavailable- added by rik5
  • -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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon Jan 18 17:03:01 2016rik5StatusConfirmed=>Fixed
    Wed Dec 16 01:18:23 2015lachlanAttached File-=>Added bug_39789.cset, #35756
    Thu Nov 26 17:39:19 2015rik5Carbon-Copy-=>Added lachlan
    Tue Aug 20 05:08:25 2013rik5StatusNone=>Confirmed
    Thu Aug 15 08:24:47 2013NoneAttached File-=>Added testcell111.m, #28848

    Back to the top

    Powered by Savane 3.1-cleanup1