[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59704] function call on classdef subobject fa
From: |
Fernando |
Subject: |
[Octave-bug-tracker] [bug #59704] function call on classdef subobject fails with "numel: invalid return value" |
Date: |
Thu, 24 Dec 2020 12:25:22 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0 |
Follow-up Comment #2, bug #59704 (project octave):
I did some debugging. It seems that, when calling "numel" in:
https://hg.savannah.gnu.org/hgweb/octave/file/45abff4199d8/libinterp/octave-value/ov-classdef.cc#l254
octave incorrectly uses the left-value list [~, this.p] of the current
statement:
+verbose+
[~, this.p] = bug59704_test(this.p);
-verbose-
to bind the result of the execution of numel. Because of the ~, the output of
numel is ignored, and that causes the error.
A possible fix would be to temporarily set to null the left-value list of the
current statement before calling numel. That could be done by inserting the
following lines
octave::interpreter& interp = octave::__get_interpreter__
("octave_classdef::xnumel");
octave::tree_evaluator& tw = interp.get_evaluator();
octave::unwind_action act ([&tw] (const
std::list<octave::octave_lvalue> *lvl)
{
tw.set_lvalue_list (lvl);
}, tw.lvalue_list ());
tw.set_lvalue_list (nullptr);
just before
https://hg.savannah.gnu.org/hgweb/octave/file/45abff4199d8/libinterp/octave-value/ov-classdef.cc#l254
You also need to include "oct-lvalue.h"
I tried it and it works, but maybe there is a better solution. I am not too
familiarized with the code.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59704>
_______________________________________________
Mensaje enviado vía Savannah
https://savannah.gnu.org/