bugGNU Octave - Bugs: bug #59617, Function handles in argument list...

 
 

bug #59617: Function handles in argument list impede dispatching to correct class

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Fri 04 Dec 2020 07:35:04 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 6.1.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 20 Dec 2020 04:58:01 PM UTC, comment #7: 

Thanks.
Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Mon 14 Dec 2020 07:18:35 PM UTC, comment #6: 

Sorry for the delay.  I pushed the change on stable and merged with default.

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

John W. Eaton <jwe>
Group administrator
Sat 12 Dec 2020 04:13:36 PM UTC, comment #5: 

I compiled with this patch on Ubuntu and for Windows.
It fixes the issue for me, too, on both platforms.
Also the example code in bug #59631 seems to work correctly with this change. And all BISTs still pass.

Markus Mützel <mmuetzel>
Group administrator
Fri 11 Dec 2020 07:29:16 PM UTC, comment #4: 

The attached patch appears to fix the problem for me.

Markus: I'll push once I create a proper BIST from your test case.


(file #50441)

John W. Eaton <jwe>
Group administrator
Sun 06 Dec 2020 02:56:19 PM UTC, comment #3: 

This looks like a regression in core Octave to me.

With the attached @classA in Matlab R2020b:

>> a = classA();
>> max(a,1)
This is classA.max
>> max(1,a)
This is classA.max
>> max(@() 1,a)
This is classA.max
>> max(a, @() 1)
This is classA.max


And in Octave 6.1:

>> A = classA();
>> max(A,1)
This is classA.max
>> max(1,A)
This is classA.max
>> max(@() 1,A)
error: max: cannot compute max (function handle, class)
>> max(A, @() 1)
This is classA.max


This is also a change in behavior with respect to earlier versions of Octave (see comment #2).

(file #50410)

Markus Mützel <mmuetzel>
Group administrator
Sun 06 Dec 2020 09:21:48 AM UTC, comment #2: 

The diagnosis is pretty simple. It seems that Octave 6 will only call a method of a class it the first argument is an instance of that class.

This was not the case in Octave 5. For instance, with the interval package loaded, this code:


fsolve (<function handle>, <infsup object>)


will use the file @infsup/fsolve.m, while in Octave 6 it will use the core function m/optimization/fsolve.m, even though the interval package is loaded.

Rafael Laboissière <rlaboiss>
Fri 04 Dec 2020 08:43:38 PM UTC, comment #1: 

I narrowed down the problem to the following example:

This works with Octave 5:


$ octave-cli --version | head -n 1
GNU Octave, version 5.2.0
$ echo 'pkg load interval; fsolve (@sin, infsup (-1, 1))' | octave-cli -q
ans = [-0.0078125, +0.0078125]


but fails with Octave 6:


$ octave-cli --version | head -n 1
GNU Octave, version 6.1.0
$ echo 'pkg load interval; fsolve (@sin, infsup (-1, 1))' | octave-cli -q
error: Invalid call to fsolve.  Correct usage is:

 -- fsolve (FCN, X0)
 -- fsolve (FCN, X0, OPTIONS)
 -- [X, FVAL, INFO, OUTPUT, FJAC] = fsolve (...)
[…]


Is this a problem in Octave 6 (overloaded function not being recognized) or a problem in the interval package?

Rafael Laboissière <rlaboiss>
Fri 04 Dec 2020 07:35:04 AM UTC, original submission:  

Building the documentation against Octave 6.1. fails with the following error message:


$ cd doc
$ OCTAVE='octave --no-window-system --no-init-file' make
 [OCTAVE] image/interval-sombrero.m
warning: 'matrix' object indexed with empty index list
warning: called from
    numel at line 39 column 10
    repmat at line 107 column 3
    meshgrid at line 84 column 8
    image/interval-sombrero.m at line 16 column 8

warning: 'matrix' object indexed with empty index list
warning: called from
    numel at line 39 column 10
    repmat at line 107 column 3
    meshgrid at line 85 column 8
    image/interval-sombrero.m at line 16 column 8

 [IMAGEMAGICK] image/interval-sombrero.m.png
 [OCTAVE] image/poly-example-surf.m
 [IMAGEMAGICK] image/poly-example-surf.m.png
 [MAKEINFO --plaintext] image/cameleon.m.texinfo
 [OCTAVE] image/cameleon.m
error: Invalid call to fsolve.  Correct usage is:

 -- fsolve (FCN, X0)
 -- fsolve (FCN, X0, OPTIONS)
 -- [X, FVAL, INFO, OUTPUT, FJAC] = fsolve (...)
error: called from
    print_usage at line 98 column 5
    fsolve at line 190 column 5
    image/cameleon.m at line 48 column 25
make: *** [Makefile:29: image/cameleon.m.png] Error 1
rm image/cameleon.m


It looks like the the fsolve function is not being overloaded by @infsup/fsolve.m. This worked correctly with Octave 5.

Rafael Laboissière <rlaboiss>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #50441:  fh-btyp-diffs.txt added by jwe (465B - text/plain)
file #50410:  bug59617_dispatch_class.zip added by mmuetzel (555B - application/x-zip-compressed)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by svillemot
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by rlaboiss (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 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-20 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-12-14 jwe StatusPatch Reviewed Ready For Test
    2020-12-12 mmuetzel StatusPatch Submitted Patch Reviewed
    2020-12-11 jwe Attached File- Added fh-btyp-diffs.txt, #50441
        StatusNone Patch Submitted
    2020-12-07 svillemot Carbon-Copy- Added svillemot
    2020-12-07 mmuetzel Dependencies- bugs #59631 is dependent
    2020-12-06 mmuetzel CategoryOctave Package Interpreter
    2020-12-06 mmuetzel Attached File- Added bug59617_dispatch_class.zip, #50410
        Item GroupBuild Failure Regression
        Releaseother 6.1.0
        Operating SystemGNU/Linux Any
        Summary[octave forge] (interval) Failure in building the documentation against Octave 6.1 Function handles in argument list impede dispatching to correct class

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code