bugGNU Octave - Bugs: bug #64574, VM causes "'%nargout'...

 
 

bug #64574: VM causes "'%nargout' undefined near line" error

Submitter:  None
Submitted:  Sun 20 Aug 2023 08:23:05 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  9.1.0 (current stable)
Planned Release:  9.1.0 (current stable)
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 12 Sep 2023 08:02:22 PM UTC, comment #8: 

No complaints. Closing as fixed.

Arun Giridhar <arungiridhar>
Group Member
Wed 23 Aug 2023 11:36:04 PM UTC, comment #7: 

Thanks for the patch. Pushed to https://hg.savannah.gnu.org/hgweb/octave/rev/a32650514d38

Ready for test.

Arun Giridhar <arungiridhar>
Group Member
Tue 22 Aug 2023 10:48:58 AM UTC, comment #6: 

Seems to work. No more errors when executing the function


But note that '__compile__ fnname print' still fails with an error

        ip:25400 obj=0x7f3e727d2bc0
code: (n=25402)
error: Unknown op: 188

The bug report could be split: this one closed and and a new one could be entered to follow up for this issue.

Anonymous
Mon 21 Aug 2023 05:29:40 PM UTC, comment #5: 

Thanks for the trace. Opcode INDEX_ID1_MATHY_UFUN is the sinner. The bug was due to a check for needed slot width was off by one and 'round' happened to be id # 256.

A patch fixing the issue is attached.



(file #55065)

Petter <petter>
Mon 21 Aug 2023 01:13:01 AM UTC, comment #4: 

The lines around the statement causing the error.

l: 1084 c:   21 ip0:16498 ip1:16541  b  = f1(data(idx,r.b)) - f1(data(idx,r.c))
l: 1084 c:   23 ip0:16498 ip1:16500
l: 1084 c:   39 ip0:16500 ip1:16502
l: 1084 c:   45 ip0:16502 ip1:16504
l: 1084 c:   49 ip0:16504 ip1:16506
l: 1084 c:   49 ip0:16506 ip1:16512
l: 1084 c:   39 ip0:16512 ip1:16515
l: 1084 c:   23 ip0:16515 ip1:16518
l: 1084 c:   77 ip0:16518 ip1:16520
l: 1084 c:   93 ip0:16520 ip1:16522
l: 1084 c:   99 ip0:16522 ip1:16524
l: 1084 c:  103 ip0:16524 ip1:16526
l: 1084 c:  103 ip0:16526 ip1:16532
l: 1084 c:   93 ip0:16532 ip1:16535
l: 1084 c:   77 ip0:16535 ip1:16538

l: 1085 c:   27 ip0:16541 ip1:16568  if (x <= 1 || x > 6)
l: 1085 c:   11 ip0:16541 ip1:16543
l: 1085 c:   30 ip0:16549 ip1:16551

l: 1086 c:   23 ip0:16568 ip1:16572    a = b;
l: 1086 c:   25 ip0:16568 ip1:16570

l: 1089 c:   17 ip0:16572 ip1:16598  MeanDelta = round(mean(a-b)+0.2);
l: 1089 c:   19 ip0:16572 ip1:16576
l: 1089 c:   25 ip0:16576 ip1:16578
l: 1089 c:   33 ip0:16578 ip1:16580
l: 1089 c:   47 ip0:16580 ip1:16582
l: 1089 c:   25 ip0:16583 ip1:16586
l: 1089 c:   19 ip0:16591 ip1:16596

l: 1091 c:   14 ip0:16598 ip1:16603   foobar = 1;


Trace:
sp  : 0x7f0e2918f170
bsp : 0x7f0e2918e008
sp i: 557
sp ii: 557
ip  : 16498
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 20

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16500
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 20

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16502
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 41

Trace:
sp  : 0x7f0e2918f188
bsp : 0x7f0e2918e008
sp i: 560
sp ii: 560
ip  : 16504
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 103

Trace:
sp  : 0x7f0e2918f190
bsp : 0x7f0e2918e008
sp i: 561
sp ii: 561
ip  : 16506
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 82

Trace:
sp  : 0x7f0e2918f190
bsp : 0x7f0e2918e008
sp i: 561
sp ii: 561
ip  : 16512
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 42

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16515
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 42

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16518
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 20

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16520
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 20

Trace:
sp  : 0x7f0e2918f188
bsp : 0x7f0e2918e008
sp i: 560
sp ii: 560
ip  : 16522
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 41

Trace:
sp  : 0x7f0e2918f190
bsp : 0x7f0e2918e008
sp i: 561
sp ii: 561
ip  : 16524
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 103

Trace:
sp  : 0x7f0e2918f198
bsp : 0x7f0e2918e008
sp i: 562
sp ii: 562
ip  : 16526
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 82

Trace:
sp  : 0x7f0e2918f198
bsp : 0x7f0e2918e008
sp i: 562
sp ii: 562
ip  : 16532
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 42

Trace:
sp  : 0x7f0e2918f188
bsp : 0x7f0e2918e008
sp i: 560
sp ii: 560
ip  : 16535
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 42

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16538
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 6

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16540
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 254

Trace:
sp  : 0x7f0e2918f170
bsp : 0x7f0e2918e008
sp i: 557
sp ii: 557
ip  : 16541
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 41

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16543
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 131

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16545
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 50

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16546
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 9

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16547
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 180

Trace:
sp  : 0x7f0e2918f170
bsp : 0x7f0e2918e008
sp i: 557
sp ii: 557
ip  : 16549
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 41

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16551
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 140

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16555
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 15

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16557
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 9

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16558
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 180

Trace:
sp  : 0x7f0e2918f170
bsp : 0x7f0e2918e008
sp i: 557
sp ii: 557
ip  : 16560
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 49

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16562
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 181

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16565
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 11

Trace:
sp  : 0x7f0e2918f170
bsp : 0x7f0e2918e008
sp i: 557
sp ii: 557
ip  : 16572
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 140

Trace:
sp  : 0x7f0e2918f178
bsp : 0x7f0e2918e008
sp i: 558
sp ii: 558
ip  : 16576
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 20

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16578
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 41

Trace:
sp  : 0x7f0e2918f188
bsp : 0x7f0e2918e008
sp i: 560
sp ii: 560
ip  : 16580
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 41

Trace:
sp  : 0x7f0e2918f190
bsp : 0x7f0e2918e008
sp i: 561
sp ii: 561
ip  : 16582
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 6

Trace:
sp  : 0x7f0e2918f188
bsp : 0x7f0e2918e008
sp i: 560
sp ii: 560
ip  : 16584
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 226

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16586
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 140

Trace:
sp  : 0x7f0e2918f188
bsp : 0x7f0e2918e008
sp i: 560
sp ii: 560
ip  : 16590
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 5

Trace:
sp  : 0x7f0e2918f180
bsp : 0x7f0e2918e008
sp i: 559
sp ii: 559
ip  : 16592
code: 0x7f0e10881270
data: 0x7f0dfae53970
ids : 0x7f0dfad35ef0
fn  : fname
Next op: 37

error: '%nargout' undefined near line 1089, column 19








(Took ages to run – Trace display is slowing down massively an already minutes long running function...)

Anonymous
Sun 20 Aug 2023 01:02:02 PM UTC, comment #3: 

The negative ips are markers for tree objects that are evaled, so it's fine.

Opcode 187 does not exist however, so something is wrong, (unless there is a bug in the print opcode routine).

Could you run:

dbstop sind %debugging need to be active for print trace to work
__vm_print_trace__
fnname


Unless there is error handling in try catches or unwind the last few printed opcodes should at least point to which opcode that is messing up.

Petter <petter>
Sun 20 Aug 2023 11:50:23 AM UTC, comment #2: 

Well - Interesting. The command _compile_ fnname print
fails with an error in the "dbg tree object:" section

"code: (n=25336)
error: Unknown op: 187"


The "source code lut:" section has only positive ips starting normally and ends with
"l:   13 c:   13 ip0:   22 ip1:   26"
...
"l: 1555 c:    1 ip0:25334 ip1:25335"
 
Nut note that the dbg tree object session starts with negative ip numbers which seems odd.

"dbg tree object:
ip:-24051 obj=0x7f71147de770
ip:-24015 obj=0x7f71147de6f0"
...
        ip:25334 obj=0x7f71148415a0
code: (n=25336)
error: Unknown op: 187

The octave function in question is rather big having about 500 entries in the "slots:" section (and as one can see in source code lut: 1500+ lines of code)

Anonymous
Sun 20 Aug 2023 09:58:05 AM UTC, comment #1: 

'%nargout' is the 0th slot storing the amount of anticipated returns as a native 64-bit int and should not end up be used like that.

So I guess either that the instructions have got out of sync (.i.e the VM instruction pointer has come one byte off or something) or there is a bug in the compilation which set some slot number to zero.

Could you add:

foobar = 1;
c = round(mean(a - b) + 0.2);


and run '__compile__ fnname print' and post the opcodes around the 'foobar' identifier?

Don't post all opcodes since that can recreate your program if it got sensitive data.

Petter <petter>
Sun 20 Aug 2023 08:23:05 AM UTC, original submission:  

The VM causes an error "'%nargout' undefined near line".

This is always reproducible as part of my rather large DB and octave program which is not shareable.
Unfortunately I did not manage to recreate this error within a small test program using a few variables (I tried not too hard though).

But the error and the error message seems revealing. It occurs in the first iteration of a loop containing complex business logic.
The program line which fails with the error message is

c = round(mean(a - b) + 0.2);

Interesting enough: If I split the command into separate statements, the program works fine with VM enabled( _enable_vm_eval_ (1)) without error:

a1 = mean(a - b) + 0.2;
c = round(a1 + 0.2);

Additional information
======================
If I catch the error in debug mode and execute the command manually (so via octave interpreter), it works without error.

a and b are a 12x1 vector in this first iteration with the same values, so the overall result is 0
mean(a-b) = 0 and round(0+0.2) = 0

Of course the program works overall fine with  _enable_vm_eval_ (0)

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #55065:  32299.patch added by petter (1KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-10-09 jwe CategoryJIT Acceleration Interpreter
    2023-09-12 arungiridhar StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2023-08-23 arungiridhar CategoryNone JIT Acceleration
        StatusNone Ready For Test
        Operating SystemGNU/Linux Any
        Fixed ReleaseNone 9.1.0 (current stable)
        Planned ReleaseNone 9.1.0 (current stable)
    2023-08-21 petter Attached File- Added 32299.patch, #55065

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code