bugGNU Octave - Bugs: bug #35118, incorrect builtin() behaviour in...

 
 

bug #35118: incorrect builtin() behaviour in object methods

Submitter:  None
Submitted:  Mon 19 Dec 2011 07:59:26 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  J.J. Green Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 16 Nov 2021 11:09:44 PM UTC, comment #4: 

I still see problems in Octave 6.4.0, although not sure if the error is unchanged.

After creating the three function files under @myobj, i get:


>> x = myobj ("test");
>> transpose (x)
error: max_recursion_depth exceeded
error: called from
    transpose
    transpose at line 3 column 3


Nicholas Jankowski <nrjank>
Group Member
Sat 19 Nov 2016 07:48:17 PM UTC, comment #3: 

This bug is still present in Octave 4.2.0.

Hartmut <hardy>
Thu 21 Feb 2013 03:52:10 PM UTC, comment #2: 

The problem still exists in a fresh development build.


Julien Bect <jbect>
Sun 08 Jan 2012 10:33:00 PM UTC, comment #1: 

This issue has been present since at least version 3.2.4 and I can reproduce it in 3.4.3 as well as with a development tip.  Simpler code to reproduce the problem, once the @myobj directory is in place, is


x = myobj ("test");
transpose (x)


Rik <rik5>
Group administrator
Mon 19 Dec 2011 07:59:26 PM UTC, original submission:  

Consider the following trivial class


@myobj/myobj.m

function f = myobj(str)
  f.name = str;
  f = class(f,'myobj');

@myobj/display.m

function display(f)
  fprintf('%s\n',f.name);

@myobj/transpose.m

function f = transpose(g)
  % do interesting things with input ...
  f = builtin('transpose',g);


Now, lets make an array of these ...


GNU Octave, version 3.5.90+
Copyright (C) 2011 John W. Eaton and others.
:

octave:1> p = myobj('foo')
foo
octave:2> q = myobj('bar')
bar
octave:3> a = [p q]
foo
bar
octave:4> size(a)
ans =

   1   2

octave:5> class(a)
ans = myobj
octave:6> b = a.'
error:   ../@myobj/transpose.m at line 3, column 3
error:   ../@myobj/transpose.m at line 3, column 3
 :
(and lots more of these)


It seems that the builtin array transpose is not "seen"
in the overloaded transpose method for the object, so it
calls itself again and again until some kind of recursion
depth is exceeded.

The same code runs fine on Matlab


                           < M A T L A B (R) >
                  Copyright 1984-2011 The MathWorks, Inc.
                    R2011b (7.13.0.564) 64-bit (glnxa64)
                              August 13, 2011

>> p = myobj('foo')
foo
>> q = myobj('bar')
bar
>> a = [p q]
foo
bar
>> size(a)

ans =

     1     2

>> b = a.'
foo
bar
>> size(b)

ans =

     2     1


Similar problems arise with other array methods (eg vertcat)

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #24630:  octave-builtin-bug.tar.gz added by None (515B - application/x-gzip - scripts exhibiting the described (mis)behavoiur)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by jbect (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-01-08 rik5 StatusNone Confirmed
    2011-12-19 None Attached File- Added octave-builtin-bug.tar.gz, #24630

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code