bugGNU Octave - Bugs: bug #40576, Assignment to Cell Array of...

 
 

bug #40576: Assignment to Cell Array of Structure Fields Gives invalid assignment Error

Submitted by:  Matt <seventhunders>
Submitted on:  Thu 14 Nov 2013 04:55:08 AM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: MattOpen/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 20 Nov 2016 06:11:56 PM UTC, comment #4:

This has been fixed in 4.2.0. Upgrade to the latest stable version of Octave to see the fix.

Rik <rik5>
Project Administrator
Thu 14 Nov 2013 02:22:48 PM UTC, comment #3:

I see the same thing with 3.6.4 and the development version. Requires a cell array with ndims > 2, a trailing singleton dimension, and assignment to a field of a structure contained in that cell array.

Mike Miller <mtmiller>
Project Administrator
Thu 14 Nov 2013 06:57:31 AM UTC, comment #2:

Actually it is a bug and here's why. The cell array pcUlBuff was created with the statement
pcUlBuf=cell(3,numEn,numCfgs);

But with numEn = 2 and numCfgs = 1. octave auto squeezes this to a 3 x 2 cell array. But the code expects to be able to index into the third dimension, otherwise you will have to have guards for special of trailing 1's in your dimensions. Something which Matlab does not require. Thanks for the observation though because it now allows for a pathetically simple test case.

Doesn't require the save file now. Intuitively one would expect that if you create an array, even if a dimension has length one, that you should be able to index that dimension.

The one dimension would naturally occur as edge cases for parameter variations and is often unavoidable.

By the way, it appears that the bug requires the cell array point to a structure with fields for some reason, in order to manifest.

Matt <seventhunders>
Thu 14 Nov 2013 06:29:54 AM UTC, comment #1:

I'm not sure the problem is quite so terrible. The sample code is indexing outside the cell array. Perhaps for compatibility Octave should be squeezing out the final singleton dimension, but in the mean time you can get the code to work by staying within your array.

Rik <rik5>
Project Administrator
Thu 14 Nov 2013 04:55:08 AM UTC, original submission:

This is a pretty nasty little bug that breaks compatibility with Matlab. Basically for fairly complex cell arrays that contain structures, it may fail to assign fields of those structures.

Consider the following code snippet. (Requires loading saved cell array file cellassbug)

Running this with the provided saved file yields the error,
error: invalid assignment to cs-list outside multiple assignment

Matlab has no problem with this, and I don't understand why octave should have issues with it either.

Matt <seventhunders>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #29617:  cellassbug added by seventhunders (248KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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
    Sun 20 Nov 2016 06:11:56 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 14 Nov 2013 02:22:48 PM UTCmtmillerStatusNone=>Confirmed
      Release3.6.4=>dev
    Thu 14 Nov 2013 04:55:08 AM UTCseventhundersAttached File-=>Added cellassbug, #29617
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1