bugGNU Octave - Bugs: bug #54966, Error when assigning array to an...

 
 

bug #54966: Error when assigning array to an object implementing subsasgn() subscripted using "{}"

Submitted by:  Martynas <mpata>
Submitted on:  Mon 05 Nov 2018 09:55:15 PM UTC  
 
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 21 Feb 2019 02:20:55 PM UTC, comment #2:

I pushed an overhauled classdef test to stable addressing this issue with some xtests:

https://hg.savannah.gnu.org/hgweb/octave/rev/ad71c8d87cff

This is no fix. The curly braces '{}' assignment does not work yet, but we have a test that works in Matlab, when it is fixed.

Kai Torben Ohlhus <siko1056>
Project Member
Tue 12 Feb 2019 12:16:13 PM UTC, comment #1:

This problem is still present in the current stable version 5.0.91.

While investigating the problem, I found a hack for 4.4.1 and 5.0.91, which of course is no solution at all. Modify your exampleclass by adding a numel method which only returns "1":

Some explanation:

The error message you are facing is called

from "libinterp/corefcn/errwarn.h". The only occurrence of this message is libinterp/parse-tree/pt-eval.cc (line 2678) [1] when the left-hand side of the assignment is checked for "numel != 1".

I think there must be added an exception for objects, but it seems to be useful for structs. At the moment I cannot come up with a proper solution to this.

[1] https://hg.savannah.gnu.org/hgweb/octave/file/7b9a5ab8350f/libinterp/parse-tree/pt-eval.cc#l2678

Kai Torben Ohlhus <siko1056>
Project Member
Mon 05 Nov 2018 09:55:15 PM UTC, original submission:

GNU Octave seems to give an error message when assigning an array with several elements to an object implementing subsasgn() method subscripted using curled braces.

Let's say we have a class (implementing the same assignment for "()" and "{}"):

And run a script trying out different assignments:

In GNU Octave the last assignment (but none of the previous ones) results in error message (path removed):

In Matlab assignments do not fail:

Martynas <mpata>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by mpata (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-26 mtmiller Severity3 - Normal => 1 - Wish
        Release5.0.91 => dev
    2019-02-12 siko1056 StatusNone => Confirmed
        Release4.4.1 => 5.0.91
        Operating SystemMicrosoft Windows => Any

    Back to the top


    Powered by Savane 3.4