bugGNU Octave - Bugs: bug #58727, classdef method invocation broken...

 
 

bug #58727: classdef method invocation broken when input is function result

Submitter:  A.R. Burgers <arb>
Submitted:  Wed 08 Jul 2020 07:27:54 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  7 - High Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 6.0.90 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 10 Jul 2020 11:01:04 PM UTC, comment #5: 

Fix verified, closing report.

Rik <rik5>
Group administrator
Fri 10 Jul 2020 10:59:35 PM UTC, comment #4: 

Definitely fixed.  Closing report.

Rik <rik5>
Group administrator
Fri 10 Jul 2020 07:34:42 AM UTC, comment #3: 

The issue seems fixed, and judging from your analysis, quite thoroughly.

A.R. Burgers <arb>
Fri 10 Jul 2020 05:25:54 AM UTC, comment #2: 

I think this bug has been around for a while now (probably since I started refactoring the interpreter call stack more than a year ago) but it just started showing up in another way recently.

To test this, you can go back to a revision before there were any attempts to fix bug #58686 (for example 627da618dcc4) and modify the test class so that the methods show the isargout status for each output by adding something like the following code to each function


      [nargin, nargout]
      isargout (1:nargout)


Than you'll see incorrect results when tc.some_str is evaluated in the argument list context in the expression


[~, tst2] = tc.do_something(tc.some_str)


The reason is that the expression "tc.some_str" is getting the isargout status for the "[~, tst2] = ..." expression instead of the appropriate status for the evaluation of each element of the argument list.

Recently, I changed the way the interpreter assigns outputs so that it could detect when function outputs were unassigned.  That change also now checks isargout and skips the assignment if the output is ignored, so that's why the argument to do_something was undefined.

I pushed the following changeset to stable and merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/aa47120a505d

John W. Eaton <jwe>
Group administrator
Fri 10 Jul 2020 12:06:48 AM UTC, comment #1: 

Confirmed.  There has been a bunch of work in the last week on how empty lists should be returned.  I'm pretty sure this is a consequence of that.  Note that if you change


[~, tst2] = tc.do_something(tc.some_str)


to


[x, tst2] = tc.do_something(tc.some_str)


then the code runs to completion.  This probably indicates that there is something about the discard operator '~' interfering with the return octave_value_list.


Rik <rik5>
Group administrator
Wed 08 Jul 2020 07:27:54 AM UTC, original submission:  

Something fundamental seems to have broken recently.
octave 6 gives this error:

ver = 6.0.1
hg_id = ea5a632b2553
tst1 = some_output
error: 'str' undefined near line 7, column 7
error: called from
    do_something at line 7 column 12
    tst at line 8 column 11


5.2 runs as expected:

ver = 5.2.1
hg_id = 75a90bfc14b1+
tst1 = some_output
tst2 = some_output


test script

ver = version
hg_id = __octave_config_info__.hg_id
tc = tst_cls;
% passing an array works
str = tc.some_str;
[~, tst1] = tc.do_something(str)
% passing the output of a method call fails
[~, tst2] = tc.do_something(tc.some_str)


test class

classdef tst_cls
  methods
    function val = some_str(obj)
      val = 'some_output';
    end
    function [out1, out2] = do_something(obj, str)
      out1 = str;
      out2 = str;
    end
  end
end


A.R. Burgers <arb>

 

(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 jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by arb (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-10 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-07-10 jwe StatusConfirmed Ready For Test
    2020-07-10 rik5 Priority5 - Normal 7 - High
    2020-07-10 rik5 StatusNone Confirmed
        Carbon-Copy- Added jwe

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code