bugGNU Octave - Bugs: bug #54028, copy of non-handle class instance...


bug #54028: copy of non-handle class instance is not deep

Submitted by:  A.R. Burgers <arb>
Submitted on:  Thu 31 May 2018 09:36:37 PM UTC  
Category:  Interpreter Severity:  4 - Important
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  4.4.0 Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

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


Wed 02 Jan 2019 04:25:22 PM UTC, comment #5:

This is a big change which isn't going to be decided on and fixed before the 5.0 release so I am marking it as WON'T FIX at https://wiki.octave.org/Bug_Fix_List_-_5.0_Release#Bugs_marked_as_regressions.

Rik <rik5>
Project Administrator
Fri 29 Jun 2018 08:38:34 PM UTC, comment #4:

Adding jwe to the CC list since this is probably going to require his understanding of when two symbol references to the same underlying variable are split (Copy-on-Write semantics).

I think I have a simpler example that uses only the object a (a.m). In this case, a single object that is changed correctly invokes COW semantics and the variables are split as shown below.

However, the struct variable array is an object array then this no longer works.

It would appear that the real issue is object arrays. I can make the example even simpler by removing the struct.

Rik <rik5>
Project Administrator
Fri 29 Jun 2018 08:16:14 PM UTC, comment #3:

This may be specific to arrays of objects. I used this modified script

And running it produces,

Rik <rik5>
Project Administrator
Fri 29 Jun 2018 07:24:40 PM UTC, comment #2:

I can't get it to work in 4.0.3

However, on 4.2.0 - 4.2.2 it works

And on 4.4.0 it produces the wrong answer

Rik <rik5>
Project Administrator
Fri 08 Jun 2018 06:46:33 AM UTC, comment #1:

This is regression: it works in 4.0.3, but not in 4.4.0

A.R. Burgers <arb>
Thu 31 May 2018 09:36:37 PM UTC, original submission:

Copying a class does not create a copy of an object array property, where as matlab does make a deep copy in this case.

a script use_b.m that attempts a copy of an instance of class b, where a_array is an object array.

output with octave

output with matlab

A.R. Burgers <arb>


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

Attach Files:

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 rik5
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by arb (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-29 rik5 Carbon-Copy- => Added jwe
    2018-06-29 rik5 Severity3 - Normal => 4 - Important
        Item GroupMatlab Compatibility => Regression
        StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.4