bugGNU Octave - Bugs: bug #65308, bytecode interpreter: incorrect...

 
 

bug #65308: bytecode interpreter: incorrect number of output arguments

Submitter:  Fernando <tutissanalio>
Submitted:  Tue 13 Feb 2024 06:43:59 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Ready For Test Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Jump to the original submission

Sat 09 Aug 2025 09:48:05 PM UTC, comment #6: 

Pushed. Ready for test.

Arun Giridhar <arungiridhar>
Group Member
Sat 12 Jul 2025 09:26:53 AM UTC, comment #5: 

The proposed patch has yet to be applied. Playing around, I found that this issue can cause a segmentation fault:


octave:> f = @(x) [x{:}] (:);
octave:> [a, b] = f ({5, 9});
fatal: caught signal Segmentation fault -- stopping myself...


The proposed patch fixes it.

Fernando <tutissanalio>
Thu 15 Feb 2024 09:32:20 PM UTC, comment #4: 

Yes, it solves the issue. Thank you.

Fernando <tutissanalio>
Wed 14 Feb 2024 11:04:00 PM UTC, comment #3: 

The attached patch should solve the issue. It was a more shallow problem than I thought.


Fix cs-list escape from matrix in bytecode interpreter (bug #65308)

A '{:}' expansion inside a matrix inside an anonymous function made
the cs-list escape the matrix when nargout was not 1, due to the
expansion inheriting the nargout value from the parent function.

Check the "special nargout -1" flag is not active, before pushing
any "inherit nargout from parent function" opcode.

* pt-bytecode-walk.cc: Chech flag
* bytecode_anon_handles.m: Add test


(file #55705)

Petter <petter>
Tue 13 Feb 2024 10:53:14 PM UTC, comment #2: 

I can reproduce it. I'll try to figure something out. There is https://savannah. ... u.org/bugs/?64783 too, so "anon function returns with cs-list" probably need some overhaul for the bytecode interpreter.

Petter <petter>
Tue 13 Feb 2024 06:46:43 PM UTC, comment #1: 

I forgot to specify in the title and description that this happens only with anonymous functions.

Fernando <tutissanalio>
Tue 13 Feb 2024 06:43:59 PM UTC, original submission:  

While investigating bug #64783, I found another bug in the bytecode interpreter, related to the number of output arguments.


>> __vm_enable__ (1)
>> f=@(x)[x{:}];
>> [a,b]=f({5,9})
a = 5
b = 9


Note that this should give an error (we are asking 2 outputs from f, but f should return only 1 output vector). Disabling the bytecode interpreter produces the correct result.


>> __vm_enable__ (0)
>> f=@(x)[x{:}];
>> [a,b]=f({5,9})
a =
   5   9

error: element number 2 undefined in return list


Fernando <tutissanalio>

 

Attached Files

Attached Files
file #55705:  octave_33192.patch added by petter (2.7KiB - text/plain)

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by petter (Posted a comment)
  • -email is unavailable- added by tutissanalio (Submitted the item)
  •  

    Votes

    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.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-08-09 arungiridhar StatusNone Ready For Test
    2024-02-14 petter Attached File- Added octave_33192.patch, #55705

    Back to the top

    Powered by Savane 3.16-a7ba.
    Corresponding source code